Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Update an Entity in the concurrent transactions?

 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends..

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..

 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any reply to my question?..

sorry, i need a clarification about it..
its a bit confusing me..

Thanks in advance..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic