i've provide version property to do optimistic locking in the concurrent transactions..
and then what is the best case for update an entity in the concurrent transactions?
what i mean is what is the best implementation to update it?..
currently i only use this way to update an entity.. :
1. i get an entity use EntityManager.find(MyExampleClass.class, id); 2. i set the property value changed
3. i update an entity //makes changes persistent in the database through EntityManager.merge(myExampleClass);
is this approach good for implementation?..
i read a post that saying "Do select before update makes performance problem in the application"..
assume that if there's any 100 transactions alive which access to that entity to update data, then there will be any 100 select statement (its mean that 100 roundtrip in the database)..
Please correct me if i'm wrong..
Thanks in advance..
Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]