As many folks here are doing, I'm integrating Cayenne into a Tapestry
application. I'd like for listener methods and any other code I
write to interact with Cayenne to be as straightforward as possible
without duplication.
One thing I've just implemented, but want to validate with the
Cayenne community, is that of automatically rolling back when an
exception is encountered in Tapestry, and also automatically
committing at the end of the request (end of the service, actually).
I'm doing this using a Tapestry IMonitor hook. I'm using session-
based DataContext stuffed into thread local storage via the
WebApplicationContextProvider listener.
My rationale is that my listener methods are then free to add and
modify data in the DataContext, but do not have to concern themselves
with doing a commit - it'll happen automatically, and likewise with
rollbacks if an exception happens.
Does this approach make sense? Are there caveats I should be
concerned with?
Thanks,
Erik
This archive was generated by hypermail 2.0.0 : Mon May 02 2005 - 16:33:11 EDT