javax.persistence.lock.timeout is beeing ignored... [message #548793] |
Fri, 23 July 2010 01:45  |
Eclipse User |
|
|
|
at the moment a try to write code for editing database-entries using pessimistic locking.
my first test code looks like this:
EntityTransaction tx=em.getTransaction();
tx.begin();
Map<String,Object> props = new HashMap<String, Object>();
props.put("javax.persistence.lock.timeout", 3000);
em.lock(entry, LockModeType.PESSIMISTIC_WRITE,props);
tx.commit();
this code works fine, but to test the timeout i get a manuell lock on the same row via commandline before executing the java code:
set autocommit=0;
select * ...for update;
the problem is, the javacode ignores the 3s timeout and doesn't throw a lock timeout exception but instead a PessimisticLockException after 60s. So how to get timeout to work?
meanwhile i tried to set the timeout in persistence.xml (em.getProperties shows it) but no success - the timeout is still ignored.
[Updated on: Fri, 23 July 2010 02:17] by Moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04571 seconds