views:

23

answers:

1

When Hibernate is used with Spring, making the DAOs extend HibernateDaoSupport provides the getHibernateTemplate() which is used to obtain the session.

When using a Hibernate Event Listener, I am extending the SaveOrUpdateEventListener and so cannot use the getHibernateTemplate() method to obtain Session.

Is there any way to obtain the session via Spring ?

+2  A: 

Have you tried to call event.getSession() in the listener?. Since listener is executed in the context of session, you doesn't need to obtain session via Spring.

axtavt