Results 1 to 4 of 4

Thread: How to configure eventlisteners in appCtx config?

  1. #1
    Join Date
    Oct 2005
    Location
    Belgium
    Posts
    87

    Default 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. #2
    Join Date
    Mar 2005
    Location
    San Francisco, CA
    Posts
    114

    Default

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

  3. #3
    Join Date
    Dec 2005
    Posts
    17

    Default Must be like ...

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

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

  4. #4
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

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