Re: Transactions

Michael Gentry <[email protected]> Sat, 4 Oct 2025 20:35:44 -0400
Newsgroups gmane.comp.java.cayenne.user
Message-ID <CAOy5kzNC=yWQZheHKh6Dc5-us9zd3jwEN6QKwMdMZOdcLUQSkg@mail.gmail.com>
--000000000000145c8206405e86b0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Ricardo,

You should provide/pair your own connection pool, such as Hikari. Cayenne
will automatically checkout connections as needed and return them to the
pool.

On Sat, Oct 4, 2025 at 7:45=E2=80=AFPM Ricardo Parada <[email protected]=
lid>
wrote:

> Thank you Andrew.
>
> I=E2=80=99ll try to put together a little example to test it out.
>
> Does Cayenne have a connection pool? If I get a Connection using the
> DataSource will it be from the connection pool?
>
> Thanks
> Ricardo
>
>
> Sent from my iPhone
>
> > On Oct 4, 2025, at 6:20=E2=80=AFPM, Andrus Adamchik <[email protected]=
m> wrote:
> >
> > =EF=BB=BFHi Ricardo,
> >
> > Yes, Cayenne provides transaction API with access to JDBC connections:
> >
> >
> https://cayenne.apache.org/docs/5.0/cayenne-guide/persistent-objects-obje=
ctcontext/#transactions
> >
> > You can use one of CayenneRuntime "performInTransaction(..)" flavors to
> wrap both Cayenne and direct JDBC operations and access Transaction objec=
t
> and its connections via "BaseTransaction.getThreadTransaction()" while
> inside the tx.
> >
> > Thanks,
> > Andrus
> >
> >
> >
> >> On Oct 4, 2025, at 5:51=E2=80=AFPM, Ricardo Parada <[email protected]=
VALID>
> wrote:
> >>
> >> Hello everyone,
> >>
> >> Let=E2=80=99s say I want to get a JDBC Connection to do something spec=
ial and
> then update some Cayenne objects (Artist, Painting) and then have
> commitChanges() update the objects in the database but also commit whatev=
er
> work was done on the JDBC Connection.
> >>
> >> Is it possible to enlist the JDBC connection to participate in a
> transaction with Cayenne?
> >>
> >> Thank you in advance for any information.
> >>
> >> Ricardo Parada
> >>
> >
>

--000000000000145c8206405e86b0--