If you use an EntityManager, you don't have access to the javax.sql.Statement object. This is the beauty of abstraction (sarcasm here): it prevents you from using the full power of the underlying technology, and it forces you to awkward acrobatics.
I would give a try to javax.persistence.query.timeout
http://stackoverflow.com/questions/24244621/set-timeout-on-entitymanager-query
https://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html_single/
query.setHint("javax.persistence.query.timeout", 2000);
see https://docs.oracle.com/javaee/6/api/javax/persistence/Query.html
but it works (actually, they told me it doesn't work AT ALL with WebLogic 12 and Eclipse JPA) only if you use Queries with EntityManager....
No comments:
Post a Comment