I'm trying to figure out how to configure my project such that JPA will timeout and throw an exception after a configured amount of time. There are two situations where I would like this to happen:
- When JPA is unable to even connect to the database
- When a JPA query takes longer than the timeout threshold to return a result set
I'm not sure if these two scenarios can be configured separately (a different timeout threshold for each), or if one threshold is used for both.
My project is currently set up as follows:
- Coding to the JPA 2.0 specification
- Using Hibernate 3.5.6 as the JPA implementation
- Using c3p0 connection pooling with Hibernate
- Using
persistence.xml
configuration file (using Hibernate-specific property values only when necessary) - NOT using any Hibernate-specific configuration files