Announcement Announcement Module
No announcement yet.
Understanding transactions and OpenSessionInViewInterceptor Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Understanding transactions and OpenSessionInViewInterceptor

    I'm using the transaction interceptor for my business layer (service layer). l'm using hibernate with JTATransactionManager.

    I'm thinking of using OpenSessionInViewInterceptor so I can efficiently lookup objects in the first level cache after it has been modified by the various business layer classes. Eg. A typical action method is:
    blObject.saveDetails(details); // saveDetails will call getDetails//
    request.setAttribute("DTO", blObject.getDetails(id));

    If I use the OpenSessionInViewInterceptor, will the second call to getDetails get the DTO from the first level cache or will it re-execute the get sql? Or does the OpenSessionInViewInterceptor only work with lazy loading?

    Does the OpenSessionInViewInterceptor create a connection immediately and closes at the end of the method?