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,040,783
  • 362
  • 3,548
  • 3,513
Drew H
  • 4,669
  • 9
  • 56
  • 89

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
  • 314,254
  • 77
  • 507
  • 490
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
  • 18,495
  • 9
  • 78
  • 139