users@jpa-spec.java.net

[jpa-spec users] Behaviour of EntityManager.lock and EntityManager.remove/detach/clear

From: Jeroen Benckhuijsen <jeroen.benckhuijsen_at_salvesdevelopment.nl>
Date: Wed, 23 Jul 2014 10:21:32 +0200

Hi,

See also my post on the hibernate forum at:
https://forum.hibernate.org/viewforum.php?f=1&start=50

However, as I've checked the JPA 2.0 spec on this and didn't find a
conclusive answer there, I've decided to also mail this list. In short my
question is as follows. What should be the behaviour in case of:

   - Repeated calls to EntityManager.lock on the same entity with a
   different lock type
      - Assumption: the last set locks is the actual one.
   - First a call to EntityManager.lock(entity, OPTIMISTIC), after which a
   call is done to EntityManager.remove(entity), EntityManager.detach(entity)
   or EntityManager.clear().
      - Assumption: the locks are removed as for remove(), there is no way
      to validate the version column any more, for detach()/clear()
these methods
      for me indicate I'm no longer interested in these entities, so locks are
      not relevant any more.

Thanks for your time...
-- 
With kind regards/Met vriendelijke groet,
Jeroen Benckhuijsen
IT Consultant/Software Architect
*Hoofdkantoor Helvoirt:*
Torenstraat 42
5268 AV Helvoirt
*Kantoor Hilversum bezoekadres:*
Arena 300
Hilversum
Telefoon : 0411-870008
Mobiel   : (+31) (0)6 520 583 54
E-mail     : jeroen.benckhuijsen_at_salvesdevelopment.nl
<http://louis%2Ejonker@salves.nl/>
Internet : www.salves.nl