From 3cc0bf5feda696dd55bd3700d2b7a7bc46e5ae28 Mon Sep 17 00:00:00 2001 From: dsyer Date: Mon, 26 May 2008 12:25:23 +0000 Subject: [PATCH] BATCH-503: Modify docos to show changes to TX configuration in factory beans. --- docs/src/site/docbook/reference/execution.xml | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/docs/src/site/docbook/reference/execution.xml b/docs/src/site/docbook/reference/execution.xml index 369fb7e52..b43a307a1 100644 --- a/docs/src/site/docbook/reference/execution.xml +++ b/docs/src/site/docbook/reference/execution.xml @@ -13,13 +13,13 @@ @@ -452,7 +452,8 @@ <bean id="jobRepository" class="org.springframework.batch.execution.repository.JobRepositoryFactoryBean" <property name="databaseType" value="hsql" /> - <property name="dataSource" value="dataSource" /> + <property name="dataSource" ref="dataSource" /> + <property name="transactionManager" ref="transactionManager" /> </bean> The databaseType property indicates the type of incrementer that @@ -497,11 +498,24 @@ repository. This is to ensure that the batch meta data, including state that is necessary for restarts after a failure, is persisted correctly. The behaviour of the framework is not well defined if the - repository methods are not transactional. + repository methods are not transactional. If you use the + JobRepositoryFactoryBean then the transaction + manager will be set up for you (this was not the case with Spring + Batch version 1.0.x). The isolation level in the + create* method attiributes is specified separately to + ensure that when jobs are launched there if two processes are trying + to launch the same job at the same time, only one will succeed. The + default isolation level for that method is SERIALIZABLE, which is + quite aggressive: READ_COMMITTED would work just as well; + READ_UNCOMMITTED would be fine if two processes are not likely to + collide in this way. However, since a call to the + create* method is quite short, it is unlikely + that the SERIALIZED will cause problems, as long as the database + platform supports it. - The Spring Batch samples have a - simple-job-launcher-context.xml configuration file that contains the - necessary details. Here is the relevant section: + To use the map DAOs you should add transaction boundaries + declaratively to the repository. Here is the relevant + configuration: <aop:config> <aop:advisor @@ -511,25 +525,14 @@ <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> - <tx:method name="create*" propagation="REQUIRES_NEW" isolation="SERIALIZABLE" /> <tx:method name="*" /> </tx:attributes> </tx:advice> - This fragment can be used as is, with almost no changes. The - isolation level in the create* method attiributes is - specified to ensure that when jobs are launched there if two - processes are trying to launch the same job at the same time, only - one will succeed. This is quite aggressive, and READ_COMMITTED would - work just as well; READ_UNCOMMITTED would be fine if two processes - are not likely to collide in this way. However, since a call to the - create* method is quite short, it is unlikely - that the SERIALIZED will cause problems, as long as the database - platform supports it. - - Remember also to include the appropiate namespace declarations - and to make sure spring-tx and spring-aop (or the whole of spring) - is on the classpath. + This fragment can be used as is, with almost no changes. + Remember also to include the appropiate namespace declarations and + to make sure spring-tx and spring-aop (or the whole of spring) is on + the classpath.
@@ -1636,4 +1639,4 @@ itself.
- + \ No newline at end of file