I am designing a banking web application where i want to store some common data shared among users/sessions. I want to persist the data but don't have any options for using database or file system. Requirement is whenever common data is modified it should be visible to all instantaneously.I would appreciate some suggestions.
- 3Where do you have the ability to store data ? Only in memory ?nos– nos2013-01-04 09:06:43 +00:00Commented Jan 4, 2013 at 9:06
- 3"Persisting" means precissely storing the data in a filesystem (directly or through a database or other ways).SJuan76– SJuan762013-01-04 09:09:33 +00:00Commented Jan 4, 2013 at 9:09
Add a comment |
4 Answers
Try to use POJO. Then store all your POJO in a List or a Map.
e.g.
//this is your pojo public class User{ private String name; private int age; public void setName(String name){ this.name = name; } public String getName(){ return this.name; } public void setAge(int age){ this.age = age; } public int getAge(){ return this.age; } } public class TestUser{ public static void main(String args[]){ //to populate record, create object user User user1 = new User(); user1.setName = "name1"; user1.setAge = "20";//then so on //after creating object, store it in a <a href="http://tutorials.jenkov.com/java-collections/index.html"collection</a>. Depends on what you want. List<User> myList = new ArrayList<User>(); //then add it to your collection myList.add(user1); //and so on //you can access now your record on your list } } Comments
I would suggest you to use Caches (Oracle Coherence , simple Map) there are many option available. If you want to persist the data for permanently then i don't thing any other option than Database/Filesystem.
Caching