|Merge does an undesirable persist [message #710278]
||Thu, 04 August 2011 21:52
| Mauro Flores
Registered: September 2009
The method merge of an entitymanager persist the entity when it doesn't exist. |
This can be a problem in a concurrent environment.
An expected updating operation...
1) foo = em.find(foo.id)
2) if (foo != null) // the entity exists!!!
can result in an insert, if between lines 2 and 3 the entity foo is deleted by another user.
Can I configure merge to throw an exception when the entity does not exist?
Powered by FUDForum
. Page generated in 0.02898 seconds