In my code I set a pessimistic lock on a table row with following code:
Map<String,Object> properties = new HashMap<String, Object>();
// GetEm() returns the currently used entity manager
getEm().find(objClass, id, LockModeType.PESSIMISTIC_WRITE, properties);
This works and the lock is really set, but if an other client tries to set a lock on the same row the LockTimeoutException is never thrown, it just hangs on the find(...) method call until the other client releases the lock (which can be up to 5 minutes).
What am I doing wrong here? I found the same example at several places always always with the comment that this exception will be thrown...
EclipseLink 2.4.1 (also didn't work with 2.3.2)