users@glassfish.java.net

JPA 2 Query timeout hint ignored

From: <forums_at_java.net>
Date: Thu, 16 Feb 2012 14:53:49 -0600 (CST)

  Hi,
 I have a web application deployed on a Glassfish 3.1.1 server and I'm using
JPA2+Hibernate (3.5.2) as my persistence framework.
 I had a look at the query timeout hint (javax.persistence.query.timeout)
which can be set as a property on the persistence.xml file, as a way to
enforce a "client side" timeout when running queries against the database ...
I'm using a JTA datasource (configured on Glassfish) in my persistence unit.
In my understanding, this means that Glassfish will setup an
EntityManagerFactory which will later interact with Hibernate's session
factory. I also thought that setting this query hint at the JPA level, would
make it be propagated down to the lower jdbc datasource level . That didn't
work to me. The only way I've found to effectively set this timeout was to
set it on the jdbc connection pool configuration on Glassfish's domain.xml
(statement-timeout-in-seconds).
The jpa spec mentions that this hint may or may not be observed, depending on
the provider. Hibernate added support for this since its 3.5.0 release
(https://hibernate.onjira.com/browse/HHH-4662).
So my question here is: Is Glassfish ignoring this hints when creating the
EntityManagerFactory ? Is there any other way to effectively set this hint on
the JPA level (I don't want to be tied to a container specific configuration
for that purpose) ???
Thanks,
Eduardo


--
[Message sent by forum member 'eduardohbcs']
View Post: http://forums.java.net/node/883588