0

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Drew H
  • 4,699
  • 9
  • 57
  • 90

3 Answers3

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