From 81526f77aca7218114e048b2db3a223180a629ac Mon Sep 17 00:00:00 2001 From: Wayne Lund Date: Mon, 11 Feb 2013 12:13:48 -0800 Subject: [PATCH] Fixed issue of "drop table" scripts causing tests to fail in samples. Only done for sqlfire and postgres. I believe others that do not have the "if exists" statements in their drop tables scripts should be retested as I have not had to do this on any other previous version. Suspect that "continueOnError" default flag has somehow gotten flipped. --- .../batch/core/schema-drop-postgresql.sql | 18 ++++++++--------- .../batch/core/schema-drop-sqlf.sql | 18 ++++++++--------- .../batch/core/schema-postgresql.sql | 1 + spring-batch-samples/pom.xml | 3 +-- .../resources/batch-postgresql.properties | 20 +++++++++++++++++++ .../src/main/resources/batch-sqlf.properties | 6 ++++-- .../resources/business-schema-postgresql.sql | 20 +++++++++---------- .../main/resources/business-schema-sqlf.sql | 20 +++++++++---------- 8 files changed, 64 insertions(+), 42 deletions(-) create mode 100644 spring-batch-samples/src/main/resources/batch-postgresql.properties diff --git a/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-drop-postgresql.sql b/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-drop-postgresql.sql index 891182071..b8bfceeaa 100644 --- a/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-drop-postgresql.sql +++ b/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-drop-postgresql.sql @@ -1,12 +1,12 @@ -- Autogenerated: do not edit this file -DROP TABLE BATCH_STEP_EXECUTION_CONTEXT ; -DROP TABLE BATCH_JOB_EXECUTION_CONTEXT ; -DROP TABLE BATCH_STEP_EXECUTION ; -DROP TABLE BATCH_JOB_EXECUTION_PARAMS ; -DROP TABLE BATCH_JOB_EXECUTION ; -DROP TABLE BATCH_JOB_INSTANCE ; +DROP TABLE IF EXISTS BATCH_STEP_EXECUTION_CONTEXT CASCADE; +DROP TABLE IF EXISTS BATCH_JOB_EXECUTION_CONTEXT CASCADE; +DROP TABLE IF EXISTS BATCH_STEP_EXECUTION CASCADE; +DROP TABLE IF EXISTS BATCH_JOB_EXECUTION_PARAMS CASCADE; +DROP TABLE IF EXISTS BATCH_JOB_EXECUTION CASCADE; +DROP TABLE IF EXISTS BATCH_JOB_INSTANCE CASCADE; -DROP SEQUENCE BATCH_STEP_EXECUTION_SEQ ; -DROP SEQUENCE BATCH_JOB_EXECUTION_SEQ ; -DROP SEQUENCE BATCH_JOB_SEQ ; +DROP SEQUENCE IF EXISTS BATCH_STEP_EXECUTION_SEQ ; +DROP SEQUENCE IF EXISTS BATCH_JOB_EXECUTION_SEQ ; +DROP SEQUENCE IF EXISTS BATCH_JOB_SEQ ; diff --git a/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-drop-sqlf.sql b/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-drop-sqlf.sql index d63d1c074..b65c4869e 100644 --- a/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-drop-sqlf.sql +++ b/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-drop-sqlf.sql @@ -1,12 +1,12 @@ -- Autogenerated: do not edit this file -DROP TABLE BATCH_STEP_EXECUTION_CONTEXT ; -DROP TABLE BATCH_JOB_EXECUTION_CONTEXT ; -DROP TABLE BATCH_STEP_EXECUTION ; -DROP TABLE BATCH_JOB_EXECUTION_PARAMS ; -DROP TABLE BATCH_JOB_EXECUTION ; -DROP TABLE BATCH_JOB_INSTANCE ; +DROP TABLE IF EXISTS BATCH_STEP_EXECUTION_CONTEXT ; +DROP TABLE IF EXISTS BATCH_JOB_EXECUTION_CONTEXT ; +DROP TABLE IF EXISTS BATCH_STEP_EXECUTION ; +DROP TABLE IF EXISTS BATCH_JOB_EXECUTION_PARAMS ; +DROP TABLE IF EXISTS BATCH_JOB_EXECUTION ; +DROP TABLE IF EXISTS BATCH_JOB_INSTANCE ; -DROP TABLE BATCH_STEP_EXECUTION_SEQ ; -DROP TABLE BATCH_JOB_EXECUTION_SEQ ; -DROP TABLE BATCH_JOB_SEQ ; +DROP TABLE IF EXISTS BATCH_STEP_EXECUTION_SEQ ; +DROP TABLE IF EXISTS BATCH_JOB_EXECUTION_SEQ ; +DROP TABLE IF EXISTS BATCH_JOB_SEQ ; diff --git a/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-postgresql.sql b/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-postgresql.sql index 82dcb00c0..d0435b3f8 100644 --- a/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-postgresql.sql +++ b/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-postgresql.sql @@ -31,6 +31,7 @@ CREATE TABLE BATCH_JOB_EXECUTION_PARAMS ( DATE_VAL TIMESTAMP DEFAULT NULL , LONG_VAL BIGINT , DOUBLE_VAL DOUBLE PRECISION , + IDENTIFYING CHAR(1) NOT NULL , constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID) references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID) ) ; diff --git a/spring-batch-samples/pom.xml b/spring-batch-samples/pom.xml index 46bb1cf4e..860be73b1 100644 --- a/spring-batch-samples/pom.xml +++ b/spring-batch-samples/pom.xml @@ -189,9 +189,8 @@ postgresql postgresql - 8.3-603.jdbc3 + 9.1-901.jdbc4 true - runtime org.springframework diff --git a/spring-batch-samples/src/main/resources/batch-postgresql.properties b/spring-batch-samples/src/main/resources/batch-postgresql.properties new file mode 100644 index 000000000..bf554dde7 --- /dev/null +++ b/spring-batch-samples/src/main/resources/batch-postgresql.properties @@ -0,0 +1,20 @@ +# Placeholders batch.* +# for Postgres: +batch.jdbc.driver=org.postgresql.Driver +batch.jdbc.url=jdbc:postgresql://localhost/samples +batch.jdbc.user=postgres +batch.jdbc.password=dba +batch.jdbc.testWhileIdle=false +batch.jdbc.validationQuery= +batch.jdbc.verifyCursorPosition=false +batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-postgresql.sql +batch.schema.script=classpath:/org/springframework/batch/core/schema-postgresql.sql +batch.business.schema.script=business-schema-postgresql.sql +batch.data.source.init=true +batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.PostgreSQLSequenceMaxValueIncrementer +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=false +batch.isolationlevel=ISOLATION_SERIALIZABLE \ No newline at end of file diff --git a/spring-batch-samples/src/main/resources/batch-sqlf.properties b/spring-batch-samples/src/main/resources/batch-sqlf.properties index f47ecf9d1..532ab10fb 100644 --- a/spring-batch-samples/src/main/resources/batch-sqlf.properties +++ b/spring-batch-samples/src/main/resources/batch-sqlf.properties @@ -1,5 +1,5 @@ # Placeholders batch.* -# for Derby: +# for SQLFire: batch.jdbc.driver=com.vmware.sqlfire.jdbc.ClientDriver batch.jdbc.url=jdbc:sqlfire://localhost:1257/;update=true batch.jdbc.user=SAMPLES @@ -7,7 +7,7 @@ batch.jdbc.password=SAMPLES batch.jdbc.testWhileIdle=false batch.jdbc.validationQuery= batch.jdbc.verifyCursorPosition=false -batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-derby.sql +batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-sqlf.sql batch.schema.script=classpath:/org/springframework/batch/core/schema-sqlf.sql batch.business.schema.script=business-schema-sqlf.sql batch.data.source.init=true @@ -17,4 +17,6 @@ batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler batch.grid.size=2 batch.jdbc.pool.size=6 batch.verify.cursor.position=false +#add this for your jobRepository bean p:isolationLevelForCreate = "${batch.isolationlevel}" +#see simple-job-launcher-context.xml for example batch.isolationlevel=ISOLATION_READ_COMMITTED \ No newline at end of file diff --git a/spring-batch-samples/src/main/resources/business-schema-postgresql.sql b/spring-batch-samples/src/main/resources/business-schema-postgresql.sql index 63add0c36..461a8c365 100644 --- a/spring-batch-samples/src/main/resources/business-schema-postgresql.sql +++ b/spring-batch-samples/src/main/resources/business-schema-postgresql.sql @@ -1,14 +1,14 @@ -- Autogenerated: do not edit this file -DROP SEQUENCE BATCH_STAGING_SEQ ; -DROP SEQUENCE TRADE_SEQ ; -DROP SEQUENCE CUSTOMER_SEQ ; -DROP TABLE BATCH_STAGING ; -DROP TABLE TRADE ; -DROP TABLE CUSTOMER ; -DROP TABLE PLAYERS ; -DROP TABLE GAMES ; -DROP TABLE PLAYER_SUMMARY ; -DROP TABLE ERROR_LOG ; +DROP SEQUENCE IF EXISTS BATCH_STAGING_SEQ ; +DROP SEQUENCE IF EXISTS TRADE_SEQ ; +DROP SEQUENCE IF EXISTS CUSTOMER_SEQ ; +DROP TABLE IF EXISTS BATCH_STAGING ; +DROP TABLE IF EXISTS TRADE ; +DROP TABLE IF EXISTS CUSTOMER ; +DROP TABLE IF EXISTS PLAYERS ; +DROP TABLE IF EXISTS GAMES ; +DROP TABLE IF EXISTS PLAYER_SUMMARY ; +DROP TABLE IF EXISTS ERROR_LOG ; -- Autogenerated: do not edit this file diff --git a/spring-batch-samples/src/main/resources/business-schema-sqlf.sql b/spring-batch-samples/src/main/resources/business-schema-sqlf.sql index 027892559..59d67936e 100644 --- a/spring-batch-samples/src/main/resources/business-schema-sqlf.sql +++ b/spring-batch-samples/src/main/resources/business-schema-sqlf.sql @@ -1,15 +1,15 @@ -- Autogenerated: do not edit this file -- You might need to remove this section the first time you run against a clean database -DROP TABLE BATCH_STAGING_SEQ ; -DROP TABLE TRADE_SEQ ; -DROP TABLE CUSTOMER_SEQ ; -DROP TABLE BATCH_STAGING ; -DROP TABLE TRADE ; -DROP TABLE CUSTOMER ; -DROP TABLE PLAYERS ; -DROP TABLE GAMES ; -DROP TABLE PLAYER_SUMMARY ; -DROP TABLE ERROR_LOG ; +DROP TABLE IF EXISTS BATCH_STAGING_SEQ ; +DROP TABLE IF EXISTS TRADE_SEQ ; +DROP TABLE IF EXISTS CUSTOMER_SEQ ; +DROP TABLE IF EXISTS BATCH_STAGING ; +DROP TABLE IF EXISTS TRADE ; +DROP TABLE IF EXISTS CUSTOMER ; +DROP TABLE IF EXISTS PLAYERS ; +DROP TABLE IF EXISTS GAMES ; +DROP TABLE IF EXISTS PLAYER_SUMMARY ; +DROP TABLE IF EXISTS ERROR_LOG ; -- Autogenerated: do not edit this file