isWithinTransactions doesn't detect native Hibernate transactions

Description

The new isWithinTransaction() method will only detect a transaction{} construct created in Lucee, and fails to return true when there is an underlying Hibernate transaction.

For example:

// start a Hibernate transaction early in the request. tx = ormGetSession().beginTransaction(); // later in the request... if ( !isWithinTransaction() ){ transaction{ entityNew( "Person" ); } }

This throws “Transaction not successfully started” because there is already an ongoing Hibernate transaction.

This method needs to support detecting an underlying Hibernate transaction which may have been created from a custom transaction manager. (Such as for working around LDEV-4017, or using a transaction wrapper in CBORM).

Activity

Show:

Pothys - MitrahSoft 5 September 2022 at 15:04

I’ve checked this ticket with the lucee latest version 5.3.10.67-SNAPSHOT. Yes, isWithinTransaction() didn’t detect native Hibernate transaction.

I’ve added a testcase to this ticket
Pull Request: https://github.com/lucee/Lucee/pull/1788

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Priority

Created 2 September 2022 at 18:16
Updated 7 September 2022 at 07:41

Flag notifications