Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » abort query
abort query [message #382786] Sun, 26 October 2008 07:28 Go to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
Currently I have a user specified Eclipselink query running inside a Foxtrot "ConcurrentWorker" task, and I want to user to be able to abort it. The query naturally is either busy in the SQL (JDBC classes) or busy fetching data (Eclipselink).

The recommended approach is not possible, since I do not have a way to insert a stop-flag into either the JDBC or Eclipselink code. I try to fire a Thread.interrupt on the thread in question, but it does not abort the query.

Is it possible to abort a query (this is not a timeout)?
Re: abort query [message #382787 is a reply to message #382786] Sun, 26 October 2008 07:51 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
> Is it possible to abort a query (this is not a timeout)?

lQuery.setHint(org.eclipse.persistence.config.QueryHints.JDB C_TIMEOUT, lJdbcTimeout);

I thought I also could have the user specify a maximum execution time up front, but the line above (set to 30 or 5 or 1) does not work. I'm using an Informix 10 database.

Tom
Re: abort query [message #382788 is a reply to message #382787] Mon, 27 October 2008 13:34 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Setting the query timeout is probably your best options.

Some JDBC drivers support a cancel() API, but whether this is supported is
dependent on the JDBC driver and the database. There is no API in JPA or
EclipseLink to cancel a query, so you would need to obtain the JDBC
statement to attempt to cancel it. Feel free to log an enhancement
request to have a cancel() API added to EclipseLink.

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.h tml#cancel()

----
James
http://www.nabble.com/EclipseLink---Users-f26658.html


James : Wiki : Book : Blog : Twitter
Re: abort query [message #382790 is a reply to message #382788] Mon, 27 October 2008 14:38 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
> Feel free to log an enhancement
> request to have a cancel() API added to EclipseLink.

Not being able to find any place to log RFE's (the Eclipselink website is somewhat confusing at times), I added it as a bug with an "RFE:" tag to the subject.
Bug 252193

I did try the QueryHints (as my second posts mentions), but that did not work either.
Re: abort query [message #382793 is a reply to message #382790] Tue, 28 October 2008 13:19 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

In Eclipse enhancements are logged in Bugzilla with Severity set to
"enhancement"

Both timeouts and cancel are JDBC operations, if your JDBC driver and
database do not support them there is little EclipseLink can do. Try
testing the timeout or cancel using raw JDBC.


James : Wiki : Book : Blog : Twitter
Previous Topic:Persistent Java Class Data Base Storage?
Next Topic:[not] exists
Goto Forum:
  


Current Time: Sat Sep 20 18:11:22 GMT 2014

Powered by FUDForum. Page generated in 0.01884 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software