Announcement Announcement Module
Collapse
No announcement yet.
How to configure eventlisteners in appCtx config? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to configure eventlisteners in appCtx config?

    Hi, I'm trying to define eventlisterens on my session factory, but it seems I'm doing it wrong

    some help...

    Code:
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="eventListeners">
    <map>
    <entry key="load">
    <list>
    <bean class="org.hibernate.event.def.DefaultPreLoadEventListener"/>
    </list>
    </entry>
    </map>
    </property>
    <property name="mappingResources">
    <list>
    Nor the following seems to work...

    Code:
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="eventListeners">
    <map>
    <entry key="load">
    <bean class="org.hibernate.event.def.DefaultPreLoadEventListener"/>
    </entry>
    </map>
    </property>
    <property name="mappingResources">
    <list>
    Some help?

  • #2
    I think you need to change your key to "pre-load" to use that listener. What errors are you getting?

    Comment


    • #3
      Must be like ...

      <bean id="myEventListener" class="...MyMergeEventListener"/>

      <property name="eventListeners">
      <map>
      <entry key="merge" value-ref="myEventListener"/>
      </map>
      </property>

      Comment


      • #4
        You should use a map and either the inner bean definition or the ref one should work. Make sure you are using the approapriate key name since otherwise Hibernate will not call your listener. You can find the listener keys in the hibernate reference documentation or inside the Hibernate dtd.

        Comment

        Working...
        X