Announcement Announcement Module
No announcement yet.
Transaction trouble Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16

    xml2008, thanks so much for the post. I don't know why I didn't go directly to the srouce and the source documentation in the first place. It would have saved me lots of pain.

    From the documentation for OpenSessionInViewFilter:
    NOTE: This filter will by default not flush the Hibernate Session, as it assumes to be used in combination with service layer transactions that care for the flushing, or HibernateAccessors with flushMode FLUSH_EAGER. If you want this filter to flush after completed request processing, override closeSession and invoke flush on the Session before closing it. Additionally, you will also need to override getSession() to return a Session in a flush mode other than the default FlushMode.NEVER. Note that getSession and closeSession will just be invoked in single session mode!
    So in conclusion, Spring was setting the flush mode to NEVER!

    To fix my problem I did as the documentation suggests and as xml2008 suggested and over-rode the getSession() and closeSession() methods in OpenSessionInViewFilter.

    Thanks for all the help.


    • #17
      OSIV deliberately sets flush mode to NEVER - it should be used along with a TransactionManager. The problem is that using tx:advice does not trigger the flush.


      • #18
        I am not using tx:advice. I am using declarative transactions with the HibernateTransactionManager and there is no flush triggered.


        • #19
          This helped quite a bit... thanks
          Last edited by hasdy; Jan 18th, 2006, 12:31 PM.