How to tell JPA to queue threads?
Hello guys!We get a ORA-00054 from Oracle when we stress our application.
The exception looks like:
java.sql.SQLException: ORA-00054: resource busy and acquire with NOWAIT specified
The code that cause this is this JPA-code:
MyObject myObject =(MyObject)em.find(MyObject.class, id);
em.lock(myObject, LockModeType.WRITE);
What we want is that when several threads access this code they should wait in a nice line until they can set there own lock.
Now it looks like that next thread accessing this code it just get a exception back from oracle.
If I'm not wrong the JPA-code above do some SQL like:
select * from myobject where id = x for update nowait
We of course would like it to do something like:
select * from myobject where id = x for update wait
But how do we send the "wait"-param?
Right now I can not give information of what version of JPA we use. I just know that we use EJB 3.0 with JBoss 5.
Bets regrads
Fredrik