hibernate session.flush with spring @transactional

后端 未结 2 1994
旧时难觅i
旧时难觅i 2021-02-20 04:34

I am using Spring and Hibernate in my application and using Spring Transaction.

So I have a service layer with annotation @Transaction on methods and DAO la

2条回答
  •  长发绾君心
    2021-02-20 05:12

    Yes, if you have @Transactional for your DAO method then you need not flush the session manually, hibernate will take care of flushing the session as part of committing the transaction if the operations in the method are successful.

    Check this link to know on how @Transactional works - Spring - @Transactional - What happens in background?

提交回复
热议问题