Friday, December 9, 2016

EntityManager and statement timeout

We spoke here about Statement Timeout to set on a Datasource

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

query.setHint("javax.persistence.query.timeout", 2000);


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: