Using Hibernate session with quartz

前端 未结 4 1775
北恋
北恋 2021-01-05 03:13

I\'ve a web application which uses framework like Struts and Hibernate. Currently I\'m developing a scheduler for this application using Quartz. While coding I realized that

4条回答
  •  被撕碎了的回忆
    2021-01-05 03:30

    One approach is to use a HibernateUtil class which builds the SessionFactory in a static initializer and makes it available via a public static getter. Your Quartz job can create a Session as HibernateUtil.getSessionFactory().getCurrentSession() and use it.

提交回复
热议问题