Benefits of using Springs Transaction management vs using hibernate

前端 未结 2 1530
小鲜肉
小鲜肉 2021-02-01 06:59

I\'ve been trying to learn spring and hibernate, and I\'ve used a lot of examples around the net to put together a nice application. However, I realized now that Spring supports

2条回答
  •  借酒劲吻你
    2021-02-01 07:47

    The spring's reference doc mentions it very clear

    The Spring Framework provides a consistent abstraction for transaction management that delivers the following benefits:

    • Provides a consistent programming model across different transaction APIs such as JTA, JDBC, Hibernate, JPA, and JDO.
    • Supports declarative transaction management.
    • Provides a simpler API for programmatic transaction management than a number of complex transaction APIs such as JTA.
    • Integrates very well with Spring's various data access abstractions.

    Provides a consistent programming model across different transaction APIs such as JTA, JDBC, Hibernate, JPA, and JDO.

    Let us say you are currently using hibernate api for transaction management and sometime down the road you would want to switch to JDO. This requires the change of transaction management code. If you use Spring then there is no change.

    Supports declarative transaction management.

    Similar to EJB

    Provides a simpler API for programmatic transaction management than a number of complex transactions APIs such as JTA.

    JTA and JDBC have different APIs for transaction management. Spring abstracts that out by providing a uniform API.

提交回复
热议问题