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

  • NestedSetInterceptor

    Hi,
    I am trying to implement the NestedSetInterceptor (from the latest Caveat emptor release) to be used with Spring .
    Anyone did that already and like to share ?

    Thanx

  • #2
    I have the DAOHibernate class
    public class ElementDAOHibernate extends BaseDAOHibernate implements ElementDAO{
    //lines skiped
    ....
    public void saveElement(Element element) {
    NestedSetInterceptor interceptor = new NestedSetInterceptor();
    interceptor.setSessionFactory(getSessionFactory()) ;
    getHibernateTemplate().setEntityInterceptor(interc eptor);
    getHibernateTemplate().saveOrUpdate(element);
    }
    }

    My problem is that the interceptor it's never called .

    I've tried to define the interceptor bean
    <bean id="nestedSetInterceptor" class="dao.hibernate.util.NestedSetInterceptor"/> and injected into the sessionFactory
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="entityInterceptor" ref="nestedSetInterceptor"/>
    <property name="mappingResources">
    ...........
    </bean>
    but the interceptor does not have a reference to the session or the sessionFactory.
    Do you know how I should use the getHibernateTemplate().setEntityInterceptor(interc eptor); ?

    Thsnx

    Comment

    Working...
    X