Thank you Andrew. 

I’ll 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 PM, Andrus Adamchik <[email protected]> wrote:
> 
> Hi Ricardo,
> 
> Yes, Cayenne provides transaction API with access to JDBC connections:
> 
> https://cayenne.apache.org/docs/5.0/cayenne-guide/persistent-objects-objectcontext/#transactions
> 
> You can use one of CayenneRuntime "performInTransaction(..)" flavors to wrap 
> both Cayenne and direct JDBC operations and access Transaction object and its 
> connections via "BaseTransaction.getThreadTransaction()" while inside the tx.
> 
> Thanks,
> Andrus
> 
> 
> 
>> On Oct 4, 2025, at 5:51 PM, Ricardo Parada <[email protected]> wrote:
>> 
>> Hello everyone,
>> 
>> Let’s say I want to get a JDBC Connection to do something special and then 
>> update some Cayenne objects (Artist, Painting) and then have commitChanges() 
>> update the objects in the database but also commit whatever 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
>> 
> 

Reply via email to