Hi, "pb00067"
Thanks a lot for your response,
I'm using a connection pool defined in Weblogic. I can set the 'lock mode to wait'
when I get the conection in Weblogic as an initial query. The problem is the next: there are some querys
which I want to wait more time for them than others. So, for this case I need to set the 'lock mode to wait' at the
level of the query. I could do this using a native query and setting the "lock mode to wait" before
executing my concrete query, and then when the query finishes I can set the "lock mode to wait" to it's default
value. But I would prefer not to use native querys, do you know any other solution?
Thanks in advance.
pb00067 wrote:
Hi,
one of the simplest ways to do this is, doing it through your connection pool configuration.
Most connection pool implementation allow to define SQL-statements which have to be executed before a
connection get borrowed to hibernate.
For example if you are using C3PO you can define:
<property name="hibernate.c3p0.testConnectionOnCheckout" value="true"/>
<property name="hibernate.c3p0.preferredTestQuery" value="SET LOCK MODE TO WAIT;select * from systables;"/>
N.B.: On C3PO the validation query must return at least one result (on other connection pool it may be enough, that it dont raises an exception)
As "SET LOCK MODE TO WAIT" probably does not return anything,
you probably have to define a second query like 'select * from systables;' or any query which without effort is returning a result.
Which connection pool are you using?
You could also check if your Informix JDBC-driver provides an apposite parameter in the connection url.