Using not existing ORM entity within transaction throws incorrect error

Description

Using a not existing entity with entityNew()/entityLoad within the transaction block throws incorrect errors like Unable to rollback against JDBC Connection with hibernate 5.4.29.15-BETA ( for the same case 3.5.5.87-SNAPSHOT throws incorrect errors like Session is closed). It should throw error as No entity (persistent component) with name [invalid_entity_name] found, available entities are [test].

Stack trace from 5.4.29.15-BETA

lucee.runtime.exp.NativeException: Unable to rollback against JDBC Connection at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.rollback(AbstractLogicalConnectionImplementor.java:127) at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.rollback(JdbcResourceLocalTransactionCoordinatorImpl.java:304) at org.hibernate.engine.transaction.internal.TransactionImpl.rollback(TransactionImpl.java:142) at org.lucee.extension.orm.hibernate.HibernateORMTransaction.end(HibernateORMTransaction.java:48) at lucee.runtime.orm.ORMConnection.setAutoCommit(ORMConnection.java:216) at lucee.runtime.orm.ORMDatasourceConnection.setAutoCommit(ORMDatasourceConnection.java:336) at lucee.runtime.db.DatasourceManagerImpl.end(DatasourceManagerImpl.java:409) at lucee.runtime.db.DatasourceManagerImpl.end(DatasourceManagerImpl.java:390) at lucee.runtime.tag.Transaction.doFinally(Transaction.java:173) at test.testcases.test_cfm$cf$5p.call(/test/testcases/test.cfm:23) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1056) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:948) ...... ...... at java.lang.Thread.run(Unknown Source) Caused by: org.hibernate.TransactionException: Unable to rollback against JDBC Connection ... 44 more Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot invoke a rollback operation when the AutoCommit mode is set to "true". at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:234) at com.microsoft.sqlserver.jdbc.SQLServerConnection.rollback(SQLServerConnection.java:3156) at lucee.runtime.db.DatasourceConnectionImpl.rollback(DatasourceConnectionImpl.java:402) at org.hibernate.resource.jdbc.internal.AbstractLogicalConnectionImplementor.rollback(AbstractLogicalConnectionImplementor.java:121) ... 43 more

Stack trace from 3.5.5.87-SNAPSHOT

lucee.runtime.exp.NativeException: Session is closed at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:139) at org.hibernate.transaction.JDBCTransaction.rollbackAndResetAutoCommit(JDBCTransaction.java:217) at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:196) at org.lucee.extension.orm.hibernate.HibernateORMTransaction.end(HibernateORMTransaction.java:40) at lucee.runtime.orm.ORMConnection.setAutoCommit(ORMConnection.java:216) at lucee.runtime.orm.ORMDatasourceConnection.setAutoCommit(ORMDatasourceConnection.java:336) at lucee.runtime.db.DatasourceManagerImpl.end(DatasourceManagerImpl.java:409) at lucee.runtime.db.DatasourceManagerImpl.end(DatasourceManagerImpl.java:390) at lucee.runtime.tag.Transaction.doFinally(Transaction.java:173) at test.testcases.test_cfm$cf.call(/test/testcases/test.cfm:23) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1056) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:948)

Environment

None

Attachments

3
  • 17 May 2024, 01:16 pm
  • 17 May 2024, 01:16 pm
  • 17 May 2024, 01:16 pm

Activity

Show:

Pothys - MitrahSoft 9 September 2024 at 08:06

I have investigated this ticket with Luce version 6.2.0.52-SNAPSHOT. Now the issue has now been resolved, and Using a not existing entity with entityNew()/entityLoad within the transaction block throws the appropriate error message.So I am closing this ticket.
Here is the PR Link:https://github.com/lucee/Lucee/pull/2415

Michael Offner 17 May 2024 at 13:16

Classic:

Screenshot 2024-05-17 at 15.14.55.png

Modern:

Screenshot 2024-05-17 at 15.14.27.png

Simple:

Screenshot 2024-05-17 at 15.14.04.png

Michael Offner 17 May 2024 at 11:47

Pothys - MitrahSoft 16 May 2024 at 15:24

I’ve added a testcase https://github.com/lucee/Lucee/pull/2364 (6.1)

Fixed

Details

Assignee

Reporter

Priority

Fix versions

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

Created 22 September 2022 at 12:31
Updated 9 September 2024 at 08:09
Resolved 9 September 2024 at 08:09

Flag notifications