Quote:
I tried transaction.setTimeout() not working.
transaction.setTimeout() only works if you use the JTA (Java Transaction Api) approach where you also have to use a TransactionManager.
(Usually the JTA approach is only used when using hibernate within an J2EE-ApplicationServer)
On queries you can do the following:
Quote:
Query q=session.createQuery("from Item").setTimeout(60); // 1 minute
But if this effectively works, depends on the jdbc-driver you use.
You have to check if/how your jdbc-driver does implement the method Statement.setQueryTimeout().
But beside all of this, as first step I suggest to analyze
why certain calls take long time.
Is it because of an index missing on a column, or is it because your query is waiting the release of locks,
or maybe the db-engine is already investing 100% cpu otherwise ?
I suggest you to analyze all calls with p6spy (and eventually also with
http://sourceforge.net/projects/sqlprofiler/) , so you can see which
calls take long time.
Maybe a simple creation of an index could resolve all your performance problems ...