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

  • Setup LobCleanUpInterceptor

    I have a util class LobCleanUpInterceptor which implements a interceptor and has methods to free temporary Large Objects.
    http://www.hibernate.org/56.html

    How do I set up the interceptor in the application context.xml?

    <!-- hibernate session factory -->
    <bean id="mySessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
    <property name="mappingResources"></>
    <property name="entityInterceptor">
    <ref local="lobCleanUpInterceptor"/>
    </property>

    does not work..

    Any help is appreciated.

  • #2
    Your config looks ok - do you get an error msg?
    I assume you defined a "lobCleanUpInterceptor" bean ?!

    Comment


    • #3
      I am not getting any error but when If I call the interceptor this way with the LocalSessionFactoryBean ,
      HibernateTemplate().saveOrUpdate() does not work? My records dont get updated.

      Should this be called elsewhere as I just want to free the temporary large objects associated with the session.

      Comment


      • #4
        But your update works without the interceptor?

        In which method do you clean your lobs (onSave, postFlush, ...)? Make sure not to clean up before the session is flushed.

        Comment


        • #5
          Yes, my updates work without the interceptor. I clean up the lobs in the postFlush method.
          Just want to know where to set up the interceptor, application context or some where else.

          Thanks.

          Comment


          • #6
            The LocalSessionFactoryBean should be the right place to do this. As an alternative you can try to assign the filter manually:
            Code:
            Interceptor intercept = new LobCleanUpInterceptor&#40;&#41;;
            Session ses = HibernateUtil.getSessionFactory&#40;&#41;.openSession &#40;intercept&#41;;
            ...
            But according to the API doc ...
            It's preferable to set it on LocalSessionFactoryBean or HibernateTransactionManager to avoid repeated configuration and guarantee consistent behavior in transactions.

            Comment

            Working...
            X