Re: Transactions

Ricardo Parada <[email protected]> Sat, 4 Oct 2025 19:43:20 -0400
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
Thank you Andrew.=20

I=E2=80=99ll try to put together a little example to test it out.=20

Does Cayenne have a connection pool? If I get a Connection using the DataSou=
rce will it be from the connection pool?

Thanks
Ricardo =20


Sent from my iPhone

> On Oct 4, 2025, at 6:20=E2=80=AFPM, Andrus Adamchik <[email protected]> w=
rote:
>=20
> =EF=BB=BFHi Ricardo,
>=20
> Yes, Cayenne provides transaction API with access to JDBC connections:
>=20
> https://cayenne.apache.org/docs/5.0/cayenne-guide/persistent-objects-objec=
tcontext/#transactions
>=20
> You can use one of CayenneRuntime "performInTransaction(..)" flavors to wr=
ap both Cayenne and direct JDBC operations and access Transaction object and=
 its connections via "BaseTransaction.getThreadTransaction()" while inside t=
he tx.
>=20
> Thanks,
> Andrus
>=20
>=20
>=20
>> On Oct 4, 2025, at 5:51=E2=80=AFPM, Ricardo Parada <[email protected]=
ID> wrote:
>>=20
>> Hello everyone,
>>=20
>> Let=E2=80=99s say I want to get a JDBC Connection to do something special=
 and then update some Cayenne objects (Artist, Painting) and then have commi=
tChanges() update the objects in the database but also commit whatever work w=
as done on the JDBC Connection.
>>=20
>> Is it possible to enlist the JDBC connection to participate in a transact=
ion with Cayenne?
>>=20
>> Thank you in advance for any information.
>>=20
>> Ricardo Parada
>>=20
>=20