-
1. Re: JBAS 4.0.3SP1 and EJB3 RC6 (NPE)
dbudworth May 2, 2006 2:47 PM (in response to dbudworth)Looking at fisheye (current rev, not sure which rev was RC6):
Looks like AbstractEntityManager::lock(entity,LockModeType)
calls getLockMode, which translates LockModeType.WRITE -> LockMode.FORCE
But AbstractEntityPersister, who takes the Hib LockMode instance, has a static map of registered types which include READ, UPGRADE and UPGRADE_NOWAIT.
It's missing FORCE
So it gets the NPE. This is assuming we're looking at the right stuff (line numbers are definately wrong, but function signatures seem correct)
So I suppose what I need is either source (to fix it), or suggestions on a work around (we need pesimistic locking in this code, and em.lock seems to be the only way to accomplish it) -
2. Re: JBAS 4.0.3SP1 and EJB3 RC6 (NPE)
dbudworth May 2, 2006 4:08 PM (in response to dbudworth)Our workaround is to switch to LockModeType.READ
which translates to LockMode.UPGRADE (which works)
I suppose the LockModeType.WRITE -> LockMode.FORCE thing is just a plain old bug? (since hibernate 3.1 AND 3.2CR1 both don't actually support FORCE, same issue in the static map) -
3. Re: JBAS 4.0.3SP1 and EJB3 RC6 (NPE)
kbhatt_81 Aug 26, 2008 9:40 AM (in response to dbudworth)Hi I am also facing same problem..
I have also checked my code and object we are passing to lock is not null but still we are getting same exception.
The below line is creating exception where em is EntityManager Object.
em.lock(vehicle, LockModeType.WRITE);
Please send any hint to solve this.
Thanks
Krunal Bhatt