Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best practice for transaction management when using Hibernate and Spring together?

As best practice, when using hibernate and spring together which transaction management should I use, Spring's transaction management or Hibernate's transaction management? I understand that both provides transaction management but since they are usually used together I dont know which to use. Does it depend on the situation or type of transaction to be handled or is there a rule of thumb when using these frameworks together?

like image 880
royjavelosa Avatar asked Feb 04 '26 08:02

royjavelosa


1 Answers

Spring is supposed to help you use Hibernate's transaction management - it's additional level of abstraction that simply works:) It is much more convenient marking which parts should be transactional (therefore handled by Spring).

Edit: Oh I almost forgot. With Spring's transactional support you will write LESS code ;)

like image 180
Xorty Avatar answered Feb 05 '26 21:02

Xorty