Under what circumstances can there be a transaction which invokes TransactionDelegate but no context at that time

DataContext is not bound to the current thread by default. User has to enable this behavior, e.g. by using the filter:

http://cwiki.apache.org/CAYDOC/web-applications.html

Essentially 'getThreadDataContext' it is not related to a transaction. It is used in this example only because (if configured) it allows a shared delegate instance to do work without knowing anything about the surrounding environment.

1. willCommit() appears to run even on a query to the database, not just when committing data. But perhaps this is just a naming thing.

This is the expected behavior. Cayenne starts an internal transaction on all Queries passed through DataDomain, including selects.

Andrus


On Sep 17, 2006, at 10:51 PM, Aristedes Maniatis wrote:

We have implemented a TransactionDelegate as per the instructions on http://cwiki.apache.org/confluence/display/CAYDOC/Understanding +Transactions We are however, finding some problems:

1. willCommit() appears to run even on a query to the database, not just when committing data. But perhaps this is just a naming thing.

2. We are getting an exception on the line of code "DataContext context = DataContext.getThreadDataContext();"

java.lang.IllegalStateException: Current thread has no bound DataContext.


Under what circumstances can there be a transaction which invokes TransactionDelegate but no context at that time?


Ari Maniatis




-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A



Reply via email to