Canceling long-running queries

2 messages Options
Embed this post
Permalink
Lawrence Gerstley

Canceling long-running queries

Reply Threaded More More options
Print post
Permalink
Hello,

If you're using Cayenne as the ORM in a thick desktop client (e.g.,  
RCP), and executing a long-running query, is there a Cayenne  
methodology for interrupting and canceling such a query, or would one  
just use normal threading?

Thanks--Lawrence
Evgeny Ryabitskiy

Re: Canceling long-running queries

Reply Threaded More More options
Print post
Permalink
Hello!
You can create separate DataContext and bind it to your separate
thread. Then you can stop you thread anytime.
 Also you can bind transaction to thread (if you want to rollback changes).

See:

1)http://cayenne.apache.org/doc20/api/cayenne/org/apache/cayenne/access/DataContext.html#createDataContext()

2)  http://cayenne.apache.org/doc20/api/cayenne/org/apache/cayenne/access/DataContext.html#bindThreadDataContext(org.apache.cayenne.access.DataContext)

3)  http://cayenne.apache.org/doc20/api/cayenne/org/apache/cayenne/access/Transaction.html#bindThreadTransaction(org.apache.cayenne.access.Transaction)

Evgeny Ryabitskiy



2009/10/20 Lawrence Gerstley <[hidden email]>:
> Hello,
>
> If you're using Cayenne as the ORM in a thick desktop client (e.g., RCP),
> and executing a long-running query, is there a Cayenne methodology for
> interrupting and canceling such a query, or would one just use normal
> threading?
>
> Thanks--Lawrence
>