Batch Insertions with Hibernate & Spring

前端 未结 3 794
名媛妹妹
名媛妹妹 2021-02-06 12:54

My application is based on Hibernate 3.2 and Spring 2.5. Here is the transaction management related snippet from the application context:

  

        
3条回答
  •  长情又很酷
    2021-02-06 13:42

    You only need the bit with flushing and clearing the session. Leave transaction management to Spring. Use sessionFactory.getCurrentSession() to reach the session that Spring has already opened for you. Also, Spring's recent recommmendation is to avoid HibernateTemplate and work directly with Hibernate's API. Inject SessionFactory to your dao-bean.

提交回复
热议问题