One reason to integrate Hibernate with Spring is transaction management. Spring provides a transaction abstraction layer over the Hibernate transaction API, and enables persistent operations to participate in global transactions. Moreover, Spring provides declarative transaction demarcation, which produces more readable and maintainable Java code. The declarative approach lets us change the transaction strategy easily, without changing the code.
The Spring transaction demarcation API has two classes for working with Hibernate applications:
org.springframework.transaction.support.TransactionTemplatefor a programmatic approach.
org.springframework.transaction.interceptor.TransactionProxyFactoryBeanfor a declarative ...