diff --git a/spring-framework-reference/src/transaction.xml b/spring-framework-reference/src/transaction.xml index 43b20f57ca4..058403586c0 100644 --- a/spring-framework-reference/src/transaction.xml +++ b/spring-framework-reference/src/transaction.xml @@ -105,9 +105,9 @@ Furthermore, a JTA UserTransaction normally needs to be sourced from JNDI, meaning that you also need to use JNDI in order to use JTA. - Obviously the use of global transactions would limit any potetntial - reuse of application code, as JTA is normally only available in an - application server environment. + Obviously the use of global transactions would limit any potential reuse + of application code, as JTA is normally only available in an application + server environment. Previously, the preferred way to use global transactions was via EJB CMT (Container Managed @@ -196,7 +196,7 @@ TR: OK AS IS - I think it's fine as is - the concepts apply to both programmatic those on JDBC connections, and face a hefty rework if you need that code to run within global, container-managed transactions. With the Spring Framework, only some of the bean definitions in your - configuration file, rather than your code, needs to change. + configuration file, rather than your code, need to change. @@ -409,15 +409,15 @@ TR:REVISED, PLS REVIEW--> instances. The DataSource bean definition will - be similar to the local JDBC example shown previously and thus not shown - in the following example. + be similar to the local JDBC example shown previously and thus is not + shown in the following example. If the DataSource, used by any non-JTA transaction manager, is looked up via JNDI and managed by a Java - EE container then it should be non-transactional because the Spring + EE container, then it should be non-transactional because the Spring Framework, rather than the Java EE container, will manage the transactions. @@ -447,7 +447,7 @@ TR:REVISED, PLS REVIEW--> <property name="sessionFactory" ref="sessionFactory" /> </bean> - If you are using Hibernate and Java EE container managed JTA + If you are using Hibernate and Java EE container-managed JTA transactions, then you should simply use the same JtaTransactionManager as in the previous JTA example for JDBC. <bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager"/> - If you use JTA then your transacton manager definition will look - the same regardles of what data access technology you use, be it JDBC, - Hibernate JPA or any other supported technology. This is due to the fact - that JTA transactions are global transactions, which can enlist any - transactional resource. + If you use JTA , then your transaction manager definition will + look the same regardless of what data access technology you use, be it + JDBC, Hibernate JPA or any other supported technology. This is due to + the fact that JTA transactions are global transactions, which can enlist + any transactional resource. In all these cases, application code does not need to change. You @@ -492,16 +492,15 @@ TR:REVISED, PLS REVIEW--> The preferred approach is to use Spring's highest level template based persistence integration APIs or to use native ORM APIs with - transaction aware factory beans or proxies for managing the native - resource factories. These transaction aware solutions internally handle + transaction- aware factory beans or proxies for managing the native + resource factories. These transaction-aware solutions internally handle resource creation and reuse, cleanup, optional transaction synchronization of the resources, and exception mapping. Thus user data access code does not have to address these tasks, but can be focused purely on non-boilerplate persistence logic. Generally, you use the - native ORM API or a template approach for JDBC - access using the JdbcTemplate. All of these - solutions are detailed in subsequent chapters of this reference - documentation. @@ -608,7 +607,7 @@ TR: OK AS IS - it's and additional tool, rarely used, but needs to be documented Unlike EJB CMT, which is tied to JTA, the Spring Framework's declarative transaction management works in any environment. It can work with JTA transactions or local transactions using JDBC, JPA, - Hibernate or JDO by simple adjusting the configuration files. @@ -715,7 +714,7 @@ would be rolled back, not necessarily following the EJB rules--> this... +TR: OK AS IS. images don't show up in the editor, but they do show up in the generated docs--> @@ -979,29 +978,30 @@ Exception in thread "main" java.lang.UnsupportedOperationException transaction infrastructure that a transaction's work is to be rolled back is to throw an Exception from code that is currently executing in the context of a transaction. The Spring - Framework's transaction infrastructure code, in its default - configuration, will catch any unhandled + Framework's transaction infrastructure code will catch any unhandled Exception as it bubbles up the call - stack, and mark the transaction for rollback. + stack, and make a determination whether to mark the transaction for + rollback. - However, the Spring Framework's transaction infrastructure code, - by default, only mark a transaction for rollback in - the case of runtime, unchecked exceptions; that is, when the thrown - exception is an instance or subclass of + In its default configuration, the Spring Framework's transaction + infrastructure code only marks a transaction for + rollback in the case of runtime, unchecked exceptions; that is, when the + thrown exception is an instance or subclass of RuntimeException. (Errors will also - by default - result in a rollback). Checked exceptions that are thrown from a transactional - method do not result in rollback. + method do not result in rollback in the default + configuration. You can configure exactly which Exception types mark a transaction for - rollback. The following XML snippet demonstrates how you configure - rollback for a checked, application-specific - Exception type. + rollback, including checked exceptions. The following XML snippet + demonstrates how you configure rollback for a checked, + application-specific Exception + type. <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> @@ -1417,7 +1417,7 @@ public class DefaultFooService implements FooService { to activate the transactional behavior. The @Transactional annotation is simply metadata that can be consumed by something that is @Transactional-aware and that can use the metadata to configure the appropriate beans with transactional behavior. @@ -1561,12 +1561,12 @@ existing BeanPostProcessor provided or something else--> that is DispatcherServlet, it only checks for @Transactional beans in your controllers, and not your services. See -->See for more information. The most derived location takes precedence when evaluating the - transactional settings for a method. In + transactional settings for a method. In the case of the following example, the DefaultFooService class is annotated at the class level with the settings for a read-only transaction, but the @@ -1734,7 +1734,7 @@ public class DefaultFooService implements FooService { shown in a transaction monitor, if applicable (for example, WebLogic's transaction monitor), and in logging output. For declarative transactions, the transaction name is always the fully-qualified class - name + "." + method + name + "." + method name of the transactionally-advised class. For example, if the handlePayment(..) method of the BusinessService class started a transaction, @@ -1877,7 +1877,7 @@ TR: REVISED, PLS REVIEW - changed it back; it's not just settings, the section d Here is the code for a simple profiling aspect discussed above. - The + The ordering of advice is controlled through the Ordered interface. For full details on advice ordering, see The result of the above configuration is a fooService bean that has profiling and transactional aspects applied to it in the desired order. You +TR: REVISED, PLS REVIEW. changed to 'desired'; seems clear that the desired order is profiling first followed by transactional aspect-->You configure any number of additional aspects in similar fashion. The following example effects the same setup as above, but uses @@ -2397,7 +2397,7 @@ txManager.commit(status); Use the correct PlatformTransactionManager implementation - based on your choice of transactional technologies and requirements. + based on your choice of transactional technologies and requirements. Used properly, the Spring Framework merely provides a straightforward and portable abstraction. If you are using global transactions, you must use the