cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kumar <kumar9885035...@gmail.com>
Subject Re: How to fire multiple sql statements as one transaction.
Date Wed, 28 Dec 2016 07:10:31 GMT
Thanks Mike. Will try and get back to you if needed.

On Tue, Dec 27, 2016 at 11:02 PM, Mike Kienenberger <mkienenb@gmail.com>
wrote:

> My understanding is that if there is a failure, it will automatically
> rollback at the database/jdbc level.  That's the whole point of a
> transaction.
>
> Since these are raw queries and not Cayenne contexts, there is nothing
> in the java code to rollback.
>
> Obviously, you would want to test this to make sure it's all working
> as expected.
>
>
> On Tue, Dec 27, 2016 at 12:29 PM, Kumar <kumar9885035454@gmail.com> wrote:
> > OK. Let me try. But can we rollback if there is a failure?
> >
> > On Tue, Dec 27, 2016 at 10:54 PM, Mike Kienenberger <mkienenb@gmail.com>
> > wrote:
> >
> >> I am not using 4.0, but it looks like it would be:
> >>
> >> Integer result = runtime.performInTransaction(() -> {
> >>
> >> /// run your queries here
> >>
> >>     // return an arbitrary result or null if we don't care about the
> result
> >>     return 5;
> >> });
> >>
> >>
> >>
> >> On Tue, Dec 27, 2016 at 12:22 PM, Kumar <kumar9885035454@gmail.com>
> wrote:
> >> > I'm using 4.0 and have gone through those docs but couldn't find what
> i
> >> > need. Can you please help me out? I just want to fire multiple native
> sql
> >> > statements using (SQLExce).
> >> >
> >> > On Tue, Dec 27, 2016 at 8:53 PM, Mike Kienenberger <
> mkienenb@gmail.com>
> >> > wrote:
> >> >
> >> >> I don't remember what version of Apache Cayenne you are using, but
> you
> >> >> can find the documentation on transactions at these two URLs.
> >> >>
> >> >> https://cayenne.apache.org/docs/3.0/understanding-transactions.html
> >> >>
> >> >> https://cayenne.apache.org/docs/4.0/cayenne-guide/
> persistent-objects-
> >> >> objectcontext.html#transactions
> >> >>
> >> >>
> >> >> On Tue, Dec 27, 2016 at 9:29 AM, Kumar <kumar9885035454@gmail.com>
> >> wrote:
> >> >> > Hey
> >> >> >
> >> >> > I have few native sql queries(some inserts, some updates). I want
> to
> >> fire
> >> >> > all at once. I mean to say if success then everything should be
> >> success
> >> >> > else none. If one is failed then do i have a chance to rollback?
> >> >> >
> >> >> > Thanks
> >> >> > Kumar
> >> >>
> >>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message