I need some help.
I am using Jboss 5.1 with Seam 2.2, Hibernate. In one of the UI page, during update action there is a database constraint violation and transaction is rolled back. After this rollback, if I try to use the entity, I get the below error:
2016-06-17 10:38:32,815 ERROR [org.hibernate.LazyInitializationException] (http-127.0.0.1-8091-2) failed to lazily initialize a collection of role: com.test.web.entity.Promotions.Results, no session or session was closed org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.test.web.entity.Promotions.Results, no session or session was closed
In order to re-attach the entity, I called the refresh() method before the above step and got the below error when the select query gets fired as a result of refresh():
2016-06-17 10:13:32,710 ERROR [org.hibernate.util.JDBCExceptionReporter] (http-127.0.0.1-8091-3) Transaction TransactionImple < ac, BasicAction: a2691f4:fb24:5763b0a4:b4 status: ActionStatus.ABORT_ONLY > cannot proceed STATUS_MARKED_ROLLBACK; - nested throwable: (javax.transaction.RollbackException: Transaction TransactionImple < ac, BasicAction: a2691f4:fb24:5763b0a4:b4 status: ActionStatus.ABORT_ONLY > cannot proceed STATUS_MARKED_ROLLBACK)
2016-06-17 10:13:32,710 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.0.1-8091-3) javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not inspect JDBC autocommit mode javax.faces.el.EvaluationException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not inspect JDBC autocommit mode
I set the below parameter in 'properties-service.xml' but it didn't make any difference:
'org.jboss.resource.connectionmanager.TxConnectionManager.ignoreStatusMarkedForRollback=true'
In 'persistence.xml', I have the below properties:
property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
property name="hibernate.connection.release_mode" value="after_transaction" />
Could you please suggest what is the problem here and how can i start using the entities post rollback? It appears that 'rollback' action is closing the session and I am not finding any way to regain the same.
Thanks !!!
why don't you catch this exception then redirect user to current page