>
> Thank you, now it's perfectly clear.
>
> When the immutable rule is followed then everything works as expected, as
> in the below successful test case:
>
@Test
public void testObjectVec3() {
//Create a new MVStore file
File file = new File(System.getProperty("java.io.tmpdir"),
"testTransactionMapWithSet.dat");
if (file.exists()) {
file.delete();
}
MVStore s = new
MVStore.Builder().fileName(file.getAbsolutePath()).open();
TransactionStore ts = new TransactionStore(s);
ts.init();
Transaction tx = ts.begin();
TransactionMap<Integer,Object[]> setMap = tx.openMap("testMap");
Object[] v = new Object[3];
v[0] = 1;
v[1] = "hi-1";
v[2] = 2;
setMap.put(0, v);
tx.commit();
tx = ts.begin();
TransactionMap<Integer,Object[]> setMap2 = tx.openMap("testMap");
Object[] vv = setMap2.get(0);
Object[] vvCopy = Arrays.copyOf(vv, vv.length);
vvCopy[2] = null;
setMap2.put(0, vvCopy);
tx.rollback();
tx = ts.begin();
TransactionMap<Integer,Object[]> setMap3 = tx.openMap("testMap");
Object[] vvv = setMap3.get(0);
System.out.println("vvv[0]="+vvv[0]+" vvv[1]="+vvv[1]+" vvv[2]="+vvv[2]);
tx.rollback();
//ASSERT OK!
assertNotNull(vvv[2]);
//Close all
ts.close();
s.close();
}
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.