Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EntityManager.find(...) with pessimistic lock never throws LockTimeoutException
EntityManager.find(...) with pessimistic lock never throws LockTimeoutException [message #963249] Mon, 29 October 2012 13:24 Go to previous message
Yennor - is currently offline Yennor -
Messages: 2
Registered: October 2012
Junior Member
In my code I set a pessimistic lock on a table row with following code:
Map<String,Object> properties = new HashMap<String, Object>();
properties.put("javax.persistence.lock.timeout", 2000);
// 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...

I'm using
EclipseLink 2.4.1 (also didn't work with 2.3.2)
Postgresql
javax.Persistence 2.0.4
 
Read Message
Read Message
Read Message
Read Message
Previous Topic:NPE in CascadeLockingPolicy.initUnmappedFieldsQuery
Next Topic:The attribute type must implement the Serializable interface.
Goto Forum:
  


Current Time: Fri May 24 06:40:52 EDT 2013

Powered by FUDForum. Page generated in 0.01565 seconds