On 1) Assume that there are 100000 UserData objects in the map.  If one 
UserData object's data members are modified, the only way I know to save 
the modified UserData object is calling 

data_store.put("user_accounts", user_accounts);

again.  The problem is that all 100000 UserData objects will be serialized 
again although there is only one object is modified.  Can anyone advise the 
right way to trigger serialization for only those modified?

Michael Wu於 2019年4月2日星期二 UTC+8上午9時35分32秒寫道:
>
> Hi,
> I am trying MVStore for storing & managing a large number of Java 
> serializable objects.
> I develop a simple Java program.  It uses a HashMap<String, UserData> to 
> keep a number of
> UserData Java objects.
>
>           mvs = MVStore.open(".\\test.h2mvs"); 
>           mvs.setAutoCommitDelay(10);
>           data_store = mvs.openMap(test_hint);
>           user_accounts = new HashMap<String, UserData>();
>           for (int i=0; i<10; i++) {
>              String id = "cust_" + (i+1);
>              user_accounts.put(id, new UserData(id));
>           }
>           data_store.put("user_accounts", user_accounts);
>           ...
>           mvs.close();
>
> I found that all of the UserData objects contained in the user_accounts 
> HashMap are
> serialized to the file if the following code
>
>           data_store.put("user_accounts", user_accounts);
>
> is executed.  I have two questions (needs):
>
> 1) How to trigger the serialization to happen when one of serveral 
> UserData objects
> in the user_accounts HashMap are modified?
>
> 2) How to serialize only those UserData objects in the user_accounts 
> HashMap modified?
>
> Any help will be highly appreciated!
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to