What happens to the mysql query if the user just closes the page? Should I be doing any kind of checking for this? I'm using JPA 2.0(EclipseLink 2.0), JSF 2.0, EJB 3.1(lite) and Glassfish 3.1. Thanks.
Asked
Active
Viewed 420 times
3 Answers
4
In the database, the query will continue to run until completion. It's possible to kill the session running the query, but there's a security concern with providing that ability outside of the database.

OMG Ponies
- 325,700
- 82
- 523
- 502
2
Generally there's nothing you can do to detect it or abort a query in progress. You're stuck with using up the CPU time to finish the process because there's no way to interrupt a query in progress from Java.
Why would this be an issue? What is it that you're trying to avoid?

Jeremy
- 607
- 4
- 6
2
In JPA you can define a timeout which is passed to JDBC. You can also set a maxResults to limit the number of rows returned.
JDBC now also provides a cancel() API, but JPA does not yet expose this.

James
- 17,965
- 11
- 91
- 146
-
FWIW JDO also provides a cancel() API, and also allows for queries (and their results) to be closed manually. – DataNucleus Mar 01 '11 at 18:49