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.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论