From 9bb970afe2c601759e3302585784a7d9e3a8ef20 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 22 Nov 2010 09:43:06 +0000 Subject: [PATCH] BATCH-1651: add paging reader to jdbc partitioning sample --- .../com.springsource.sts.config.flow.prefs | 3 +- .../src/main/resources/batch-derby.properties | 2 + .../src/main/resources/batch-h2.properties | 2 + .../src/main/resources/batch-hsql.properties | 4 +- .../src/main/resources/batch-mysql.properties | 2 + .../main/resources/batch-oracle.properties | 2 + .../main/resources/batch-sqlserver.properties | 2 + .../main/resources/batch-sybase.properties | 16 ++++--- .../main/resources/data-source-context.xml | 3 ++ .../resources/jobs/iosample/jdbcCursor.xml | 1 + .../main/resources/jobs/partitionJdbcJob.xml | 43 +++++++++---------- .../PartitionJdbcJobFunctionalTests.java | 2 +- 12 files changed, 50 insertions(+), 32 deletions(-) diff --git a/spring-batch-samples/.settings/com.springsource.sts.config.flow.prefs b/spring-batch-samples/.settings/com.springsource.sts.config.flow.prefs index f6f1e6031..1d74baa0d 100644 --- a/spring-batch-samples/.settings/com.springsource.sts.config.flow.prefs +++ b/spring-batch-samples/.settings/com.springsource.sts.config.flow.prefs @@ -1,3 +1,4 @@ -#Mon May 17 10:38:33 BST 2010 +#Mon Nov 22 08:44:57 GMT 2010 //com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-samples/src/main/resources/jobs/ioSampleJob.xml=\n\n\n\n\n\n +//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-samples/src/main/resources/jobs/partitionJdbcJob.xml=\n\n\n\n\n\n\n\n\n\n eclipse.preferences.version=1 diff --git a/spring-batch-samples/src/main/resources/batch-derby.properties b/spring-batch-samples/src/main/resources/batch-derby.properties index ba9091b3e..7d6798854 100644 --- a/spring-batch-samples/src/main/resources/batch-derby.properties +++ b/spring-batch-samples/src/main/resources/batch-derby.properties @@ -6,6 +6,7 @@ batch.jdbc.user=app batch.jdbc.password= batch.jdbc.testWhileIdle=false batch.jdbc.validationQuery= +batch.jdbc.verifyCursorPosition=false batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-derby.sql batch.schema.script=classpath:/org/springframework/batch/core/schema-derby.sql batch.business.schema.script=business-schema-derby.sql @@ -14,4 +15,5 @@ batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.De batch.database.incrementer.parent=columnIncrementerParent batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler batch.grid.size=2 +batch.jdbc.pool.size=6 batch.verify.cursor.position=false \ No newline at end of file diff --git a/spring-batch-samples/src/main/resources/batch-h2.properties b/spring-batch-samples/src/main/resources/batch-h2.properties index c22653b2e..56737c533 100644 --- a/spring-batch-samples/src/main/resources/batch-h2.properties +++ b/spring-batch-samples/src/main/resources/batch-h2.properties @@ -6,6 +6,7 @@ batch.jdbc.user=sa batch.jdbc.password= batch.jdbc.testWhileIdle=false batch.jdbc.validationQuery= +batch.jdbc.verifyCursorPosition=true batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-h2.sql batch.schema.script=classpath:/org/springframework/batch/core/schema-h2.sql batch.business.schema.script=classpath:/business-schema-h2.sql @@ -14,4 +15,5 @@ batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.H2 batch.database.incrementer.parent=sequenceIncrementerParent batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler batch.grid.size=2 +batch.jdbc.pool.size=6 batch.verify.cursor.position=true diff --git a/spring-batch-samples/src/main/resources/batch-hsql.properties b/spring-batch-samples/src/main/resources/batch-hsql.properties index 523673a86..6ffc76fa5 100644 --- a/spring-batch-samples/src/main/resources/batch-hsql.properties +++ b/spring-batch-samples/src/main/resources/batch-hsql.properties @@ -9,6 +9,7 @@ batch.jdbc.user=sa batch.jdbc.password= batch.jdbc.testWhileIdle=false batch.jdbc.validationQuery= +batch.jdbc.verifyCursorPosition=true batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql batch.schema.script=classpath:/org/springframework/batch/core/schema-hsqldb.sql batch.business.schema.script=classpath:/business-schema-hsqldb.sql @@ -16,5 +17,6 @@ batch.data.source.init=true batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.HsqlMaxValueIncrementer batch.database.incrementer.parent=columnIncrementerParent batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler -batch.grid.size=2 +batch.jdbc.pool.size=6 +batch.grid.size=6 batch.verify.cursor.position=true diff --git a/spring-batch-samples/src/main/resources/batch-mysql.properties b/spring-batch-samples/src/main/resources/batch-mysql.properties index 3e6eef0b5..9e92c2efc 100644 --- a/spring-batch-samples/src/main/resources/batch-mysql.properties +++ b/spring-batch-samples/src/main/resources/batch-mysql.properties @@ -6,6 +6,7 @@ batch.jdbc.user=test batch.jdbc.password=test batch.jdbc.testWhileIdle=true batch.jdbc.validationQuery=SELECT 1 +batch.jdbc.verifyCursorPosition=true batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-mysql.sql batch.schema.script=classpath:/org/springframework/batch/core/schema-mysql.sql batch.business.schema.script=classpath:business-schema-mysql.sql @@ -13,5 +14,6 @@ batch.data.source.init=true batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer batch.database.incrementer.parent=columnIncrementerParent batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler +batch.jdbc.pool.size=6 batch.grid.size=50 batch.verify.cursor.position=true diff --git a/spring-batch-samples/src/main/resources/batch-oracle.properties b/spring-batch-samples/src/main/resources/batch-oracle.properties index facd8a650..69785e621 100644 --- a/spring-batch-samples/src/main/resources/batch-oracle.properties +++ b/spring-batch-samples/src/main/resources/batch-oracle.properties @@ -6,6 +6,7 @@ batch.jdbc.user=spring batch.jdbc.password=spring batch.jdbc.testWhileIdle=false batch.jdbc.validationQuery= +batch.jdbc.verifyCursorPosition=true batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-oracle10g.sql batch.schema.script=classpath:/org/springframework/batch/core/schema-oracle10g.sql batch.business.schema.script=business-schema-oracle10g.sql @@ -14,4 +15,5 @@ batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.Or batch.database.incrementer.parent=sequenceIncrementerParent batch.lob.handler.class=org.springframework.jdbc.support.lob.OracleLobHandler batch.grid.size=2 +batch.jdbc.pool.size=6 batch.verify.cursor.position=true diff --git a/spring-batch-samples/src/main/resources/batch-sqlserver.properties b/spring-batch-samples/src/main/resources/batch-sqlserver.properties index 8c20d2511..0694ae002 100644 --- a/spring-batch-samples/src/main/resources/batch-sqlserver.properties +++ b/spring-batch-samples/src/main/resources/batch-sqlserver.properties @@ -6,6 +6,7 @@ batch.jdbc.user=sa batch.jdbc.password=sa batch.jdbc.testWhileIdle=false batch.jdbc.validationQuery= +batch.jdbc.verifyCursorPosition=true batch.drop.script=/org/springframework/batch/core/schema-drop-sqlserver.sql batch.schema.script=/org/springframework/batch/core/schema-sqlserver.sql batch.business.schema.script=business-schema-sqlserver.sql @@ -14,4 +15,5 @@ batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.Sq batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler batch.database.incrementer.parent=columnIncrementerParent batch.grid.size=2 +batch.jdbc.pool.size=6 batch.verify.cursor.position=true diff --git a/spring-batch-samples/src/main/resources/batch-sybase.properties b/spring-batch-samples/src/main/resources/batch-sybase.properties index 226c44df9..7d8419d66 100644 --- a/spring-batch-samples/src/main/resources/batch-sybase.properties +++ b/spring-batch-samples/src/main/resources/batch-sybase.properties @@ -4,15 +4,17 @@ batch.jdbc.driver=net.sourceforge.jtds.jdbc.Driver batch.jdbc.url=jdbc:jtds:sybase://dbhost:5000;databaseName=test batch.jdbc.user=spring batch.jdbc.password=spring -batch.schema= -batch.jndi.name= -batch.naming.factory.initial= -batch.naming.provider.url= +batch.jdbc.testWhileIdle=false +batch.jdbc.validationQuery= +batch.jdbc.verifyCursorPosition=true +batch.drop.script=/org/springframework/batch/core/schema-drop-sybase.sql batch.schema.script=/org/springframework/batch/core/schema-sybase.sql batch.business.schema.script=business-schema-sybase.sql +batch.data.source.init=true batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.SybaseMaxValueIncrementer batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler +batch.database.incrementer.parent=columnIncrementerParent +batch.jdbc.pool.size=6 +batch.grid.size=6 +batch.verify.cursor.position=true -# Bean Properties for override -# when not using sequences: -incrementerParent.columnName=ID diff --git a/spring-batch-samples/src/main/resources/data-source-context.xml b/spring-batch-samples/src/main/resources/data-source-context.xml index 8dde8d3c8..9d1a1bc97 100644 --- a/spring-batch-samples/src/main/resources/data-source-context.xml +++ b/spring-batch-samples/src/main/resources/data-source-context.xml @@ -22,6 +22,9 @@ + + + diff --git a/spring-batch-samples/src/main/resources/jobs/iosample/jdbcCursor.xml b/spring-batch-samples/src/main/resources/jobs/iosample/jdbcCursor.xml index 45620edef..d81c9ff30 100644 --- a/spring-batch-samples/src/main/resources/jobs/iosample/jdbcCursor.xml +++ b/spring-batch-samples/src/main/resources/jobs/iosample/jdbcCursor.xml @@ -14,6 +14,7 @@ + diff --git a/spring-batch-samples/src/main/resources/jobs/partitionJdbcJob.xml b/spring-batch-samples/src/main/resources/jobs/partitionJdbcJob.xml index 6b6a6a83a..45331fef1 100644 --- a/spring-batch-samples/src/main/resources/jobs/partitionJdbcJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/partitionJdbcJob.xml @@ -8,7 +8,7 @@ - + @@ -19,7 +19,7 @@ - + @@ -34,24 +34,25 @@ - - - - = ? and ID <= ? - ]]> - + + + + - - - - - #{stepExecutionContext[minValue]} - #{stepExecutionContext[maxValue]} - - + + + + + + + - + + + + + + @@ -78,7 +79,7 @@ - + - - - + diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/PartitionJdbcJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/PartitionJdbcJobFunctionalTests.java index 705e30ae0..0bfb8a7e8 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/PartitionJdbcJobFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/PartitionJdbcJobFunctionalTests.java @@ -43,7 +43,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/partitionFileJob.xml", +@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/partitionJdbcJob.xml", "/job-runner-context.xml" }) public class PartitionJdbcJobFunctionalTests implements ApplicationContextAware {