Announcement Announcement Module
Collapse
No announcement yet.
LIE Errors After Exception Thrown in a Hibernate Interceptor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • LIE Errors After Exception Thrown in a Hibernate Interceptor

    Hi,

    I have a Hibernate interceptor that prevents a transaction from being completed upon certain conditions. The interceptor throws an exception on preFlush that leads to the transaction being rolled back. I am using @Transactional annotations on my services so this should happen automatically. I then have FlowExecutionExceptionHandler that catches these exceptions, adds the exception message to the message context, and the forces a flow execution redirect. After this happens, I begin to see LazyInitializationExceptions. I have been trying to determine why this may happen and appreciate any input. I had put breakpoints on the close method of the EntityManager, but that is not being called. Before the error, the objects are able to be lazily loaded.

    Thanks,
    Julian

    Webflow 2.2.1, JSF, Richfaces 3.3.3, Spring 3.0.5

  • #2
    So after reading this:

    "When the transaction ends, either through commit or roll back, the "current" Session is closed automatically."

    http://community.jboss.org/wiki/sess...ith_plain_JDBC

    This means that my session will always be closed. Looking at the code in the JpaTransactionManager.doRollback(DefaultTransactio nStatus status) method, it would seem this is inevitable. This is called from the TransactionInterceptor via the call to completeTransactionAfterThrowing in the invoke method.

    Can someone help me understand whether or not there is a way to prevent the clearing/closing of the session or if I need to re-associate my objects with the session? It seems that not clearing the session might leave it in an inconsistent state. Any insight would be appreciated.
    Last edited by julian; Mar 3rd, 2011, 12:00 AM.

    Comment

    Working...
    X