Results 1 to 3 of 3

Thread: About getting session with entityInterceptor

  1. #1
    Join Date
    Aug 2004
    Posts
    3

    Default About getting session with entityInterceptor

    Hi,

    When I use HibernateTransactionManager I get session without entityInterceptor,
    no entityInteceptor on HibernateTransactionManager or SessionFactory.

    Calls in my DAO class (which is subclass of HibrenateDaoSupport) use hibernateTemplate
    with enitityInreceptor(session level Interceptors), but session is unaware of that interceptor.
    Code:
      
         HibernateTempalte ht = getHibernateTemplate();
         ht.setEntityInterceptor(auditLogInterceptor);
         ht.saveOrUpdate(jci);
    I presume that calls are on session (provided by TM), and
    any hibernateTemplate calls in transaction will use this session.

    Is there any possibility to "turn on" (or off, if configured) entityInterceptor on this session?

  2. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    If you use HibernateTransactionManager (or alternately, JTATransactionManager+HibernateInterceptor), the Session will have already been created and bound to the thread, synchronized to the tx.

    So the entity interceptor setting at the level of the template will be ignored, as no new session is created there.

    If you have a need for a non-stateful entity interceptor, set it as the EntityInterceptor property of HibernateTransactionManager. If you have a need for a stateful entity interceptor, you can set a prototype entity interceptor to be used, with the new EntityInterceptorBeanName property in Spring 1.1RC1+.

    Regards,
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  3. #3
    Join Date
    Aug 2004
    Posts
    3

    Default

    Hi Colin,
    I'm facing the same problem here .
    Can you provide a small snippet of configuration for both scenarios ?

    Thanx

Similar Threads

  1. OpenSessionInView and portlet support
    By garpinc2 in forum Web Flow
    Replies: 31
    Last Post: Apr 9th, 2010, 11:12 AM
  2. OpenSessionInView + CMT Session usage
    By alesj in forum Data
    Replies: 7
    Last Post: Aug 16th, 2005, 02:32 AM
  3. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  4. Replies: 1
    Last Post: Mar 12th, 2005, 04:33 AM
  5. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •