Hi,
I came around the following problem:
I have an application accessing data via Hibernate. Transactions might be long-running if the affected data is large (large queries, delete operations with many objects, ...). I would like to restrict Hibernate to allow just a limited time for such transactions.
I read a few threads about timeout-discussion and read about Query.setTimeout() and Query.cancel(), but they really solve just a part of the problem.
Query.setTimeout() acts just on a per-statement-base, i.e. each statement could run a defined period of time, but when my session does lots of statements (whil I really can not control, that a point of Hibernate), I can not control the timeout.
The main problem of using timeouts-per-query is, that they do not affect other hibernate-actions, such as create(), delete(), ...
I would appreciate having a feature in Hibernate, that allows to define a timeout per-session, i.e. a timeout could be defined for a session (and might even have a property-based default-value) such that after reaching the timeout, every still running db-action will be aborted, new queries will not be accepted and the call to hibernate (i.e. the current call on the session) will return.
What do others think about it?
Would someone else like to have this feature?
How difficult would this be to implement?
bye,
Stephan
|