I've just noticed that Cayenne claims to create a transaction per query even
though commitChanges has only been called once. Does this mean that if
something goes wrong half way through a number of updates then half of them
will be applied and half won't?
Cheers for the info so far,
Dave
> -----Original Message-----
> From: Mike Kienenberger [mailto:mkienen..mail.com]
> Sent: 19 October 2005 17:23
> To: cayenne-use..bjectstyle.org
> Subject: Re: Transactions
>
>
> Hi Dave,
>
> In addition to each commit executing in a separate transaction, each
> select query is going to be executed in a separate transaction. Not
> sure how it matters in the case of select queries, but since you
> brought it up, I thought I'd mention it.
>
> -Mike
>
>
> On 10/19/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
> > Hi Dave,
> >
> > I was in the process of writing a long email about transactions [I
> > attach it below as it may be educational to other users], but I think
> > confusion is on another level. DataContext itself is an in-memory
> > scratchpad not related to any J2EE or DB transactions. Cayenne
> > default transaction scope ("transaction" in DB sense) starts and ends
> > within "commitChanges" method. DataContext.rollback is done in-memory.
> >
> > In most cases this is all you need, and you shouldn't worry about
> > transactions at all. But if you want to wrap your work with objects
> > in the DataContext in a bigger transaction (e.g. you are within an
> > EJB), you may do that via external transactions, as described below.
> >
> > Andrus
> >
> > --- My other email ----
> >
> > >> Maybe I'm missing something but I'm having trouble working out how
> > >> to manage
> > >> my own transactions.
> > >
> > > The simplest answer is this: check 'container-managed transactions'
> > > checkbox on a DataDomain in the modeler, and use whatever
> > > transaction mechanism you'd like (J2EE, Spring ...).
> > >
> > > While you can do certain things with Cayenne Transaction class
> > > (e.g. wrap a few raw SQL queries in a single transaction), it's
> > > main goal is integration with external transaction mechanisms.
> >
> > --- End my other email ----
> >
> >
> >
> > On Oct 19, 2005, at 11:27 AM, Dave Merrin wrote:
> >
> > > Think I'm confusing myself here. Am I right to say that Cayenne will
> > > automatically create a transaction under the hood for me? Then if
> > > revertChanges is called the transaction is implicitly rolled back?
> > >
> > > If all this is true when exactly is the transaction created? i.e. all
> > > queries/ first update or delete?
> > >
> > > Cheers,
> > >
> > > Dave
> > >
> > >
> > >> -----Original Message-----
> > >> From: Dave Merrin [mailto:dmerri..pasystems.co.uk]
> > >> Sent: 19 October 2005 16:10
> > >> To: Cayenne-User
> > >> Subject: Transactions
> > >>
> > >>
> > >>
> > >> Maybe I'm missing something but I'm having trouble working out
> > >> how to manage
> > >> my own transactions. I see there is a Transaction class and that the
> > >> DataContext has a method 'performQueries' which takes a
> > >> transaction object.
> > >>
> > >> I want to run a single query on the database in an existing
> > >> transaction. How
> > >> can I do this?
> > >>
> > >> Cheers,
> > >>
> > >> Dave
> >
> >
>
This archive was generated by hypermail 2.0.0 : Thu Oct 20 2005 - 05:27:48 EDT