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.
Asked
Active
Viewed 2,242 times
0
-
3Where do you have the ability to store data ? Only in memory ? – nos Jan 04 '13 at 09:06
-
3"Persisting" means precissely storing the data in a filesystem (directly or through a database or other ways). – SJuan76 Jan 04 '13 at 09:09
4 Answers
1
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
}
}

Jj Tuibeo
- 773
- 4
- 18
1
you can use hsql db jdbc driver which has support for creating a in-memory database checkout hsql db documentation for in-memory db support

Dungeon Hunter
- 19,827
- 13
- 59
- 82
0
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

amicngh
- 7,831
- 3
- 35
- 54
0
You can use cache like Memcached.
or you can use in-memory database like HSqlDB.

Pankaj
- 5,132
- 3
- 28
- 37