views:

194

answers:

1

If user press the "search" button and then they desided to do "something else", we have to cancel already running query.

We use Hibernate (and Oracle) as persistence solution. Hibernates Session interface provides cancelQuery() method. After some trys, it seams that cancelQuery() has no effect.

Does somebody have some experience this this Session#cancelQuery() method?

Thank you!

+2  A: 

It has an effect but with the Oracle JDBC driver, it just takes some time to happen. Just wait a minute or two.

If you can't wait, then move the cancel in a background thread (along with the session) and request a new Hibernate session in your main thread. You can't use the old session until cancelQuery() returns.

Aaron Digulla