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)
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)
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.
Please send any hint to solve this.