简体   繁体   中英

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?

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 ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM