Java EE can't complete SessionContext

231 Views Asked by At

To rollback when have error, I use javax.ejb.SessionContext to do that,

first I mark a point to rollback by sessionContext.getUserTransaction().begin()

Then I use sessionContext.getUserTransaction().rollback() to rollback and use sessionContext.getUserTransaction().commit(); to should complete transaction before returning.

but the problem is if there is nothing changed, this will throws org.hibernate.exception.GenericJDBCException: could not prepare statement. Conclusion: There is anyway to stop SessionContext ?

0

There are 0 best solutions below