开发者

Obtaining session in Hibernate Listener with Spring Integration

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 getHi开发者_StackOverflow社区bernateTemplate() method to obtain Session.

Is there any way to obtain the session via Spring ?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜