Declarative or Programmatic Transaction in Spring

后端 未结 6 1533
小蘑菇
小蘑菇 2021-02-03 10:27

What type of transaction management strategy we should use in Spring? Declarative or Programmatic? Which one is better and under what situation one should use it? Can you give a

6条回答
  •  温柔的废话
    2021-02-03 11:26

    http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/transaction.html#tx-decl-vs-prog

    and

    http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/transaction.html

    in general.

    examples:

    http://www.springbyexample.org/examples/hibernate-transaction-annotation-config.html

    New features: I suggest using DI with SessionFactory. Also take a look at 3.1 new feature: Hibernate 4 support. see http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/new-in-3.1.html#d0e1385

提交回复
热议问题