-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Event Listeners in Hibernate 4 (How to register)
PostPosted: Tue Jul 01, 2014 5:36 pm 
Newbie

Joined: Tue Jul 01, 2014 5:29 pm
Posts: 1
Hi, everyone. This is my first time in this forum. Sorry if I'm breaking some "forum law"

I 've just migrated an application from Hibernate 3 to Hibernate 4.

In Hibernate 3 I defined an eventListener in this way:
Code:
    <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource"><ref local="dataSource"/></property>
      <property name="hibernateProperties">
         <props>
            <prop key="hibernate.show_sql">${sessionFactory.hibernate.show_sql}</prop>
            <prop key="hibernate.dialect">${sessionFactory.hibernate.dialect}</prop>
            <!--<prop key="hibernate.cache.provider_class">${sessionFactory.hibernate.cache.provider_class}</prop>-->
            <prop key="connection.pool_size">1</prop>
         </props>
      </property>
        <property name="eventListeners">
            <map>
                <entry key="save-update"><ref local="servicoOnlineSaveEventListener" /></entry>
            </map><
        </property>


Now in Hibernate 4, I realized that eventListeners is no longer available on LocalSessionFaqctoryBean.

I've checked that I can extend DefaultSaveOrUpdateEventListener, but I can't figure out how to register the listener, in Xml or via annotation..

Could you point me the way of doing this.?? I wouldn't want to use code to get registry and register it that.
Is that possible?

Thanks in advance

Rui


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.