Hello, I have written a small application in java that interacts with db2 using apache cayenne. The application sends a long running query to the db2 server and awaits response. The query starts executing from within SwingWorker's doInBackground() method. During the query's execution, a cancel button appears allowing the user to cancel the operation. When clicked, SwingWorker's cancel() is called and everything seems to work fine regarding java code. The SwingWorker thread is canceled (I can confirm that). But, unfortunately, the other thread running the query doesn't stop (or perhaps it stops but the query is already being processed by db2 until finished).
Is there any way to stop the query using cayenne specific methods? I tried to create a new DataContext and bind it to the running thread (the following code is executed inside doInBackground(): BaseContext.bindThreadObjectContext(DataContext.createDataContext()); ObjectContext oc = BaseContext.getThreadObjectContext(); return oc.performQuery(longRunQuery); No success. Thank you, Nikos