Property changes on: . ___________________________________________________________________ Name: svn:ignore - target .metadata + target .metadata .hg .hgignore Index: execution/src/main/java/org/springframework/batch/execution/step/PrototypeBeanStepExecutorFactory.java =================================================================== --- execution/src/main/java/org/springframework/batch/execution/step/PrototypeBeanStepExecutorFactory.java (revision 9035) +++ execution/src/main/java/org/springframework/batch/execution/step/PrototypeBeanStepExecutorFactory.java (working copy) @@ -123,6 +123,7 @@ template.setCompletionPolicy(new SimpleCompletionPolicy( ((SimpleStepConfiguration) configuration) .getCommitInterval())); + template.setExceptionHandler(((SimpleStepConfiguration)configuration).getExceptionHandler()); } ((SimpleStepExecutor) executor) .setChunkOperations(repeatOperations); Index: samples/src/main/java/org/springframework/batch/sample/item/processor/CustomerCreditPersistProcessor.java =================================================================== --- samples/src/main/java/org/springframework/batch/sample/item/processor/CustomerCreditPersistProcessor.java (revision 0) +++ samples/src/main/java/org/springframework/batch/sample/item/processor/CustomerCreditPersistProcessor.java (revision 0) @@ -0,0 +1,40 @@ +package org.springframework.batch.sample.item.processor; + +import java.math.BigDecimal; + +import org.hibernate.SessionFactory; +import org.springframework.batch.item.ItemProcessor; +import org.springframework.batch.sample.domain.CustomerCredit; +import org.springframework.orm.hibernate3.HibernateTemplate; + +public class CustomerCreditPersistProcessor implements ItemProcessor { + private boolean first = true; + + private int incrementer = 10; + + private SessionFactory sessionFactory; + + public void setSessionFactory(SessionFactory sessionFactory) { + this.sessionFactory = sessionFactory; + } + + public void process(Object data) throws Exception { + // This does not work + CustomerCredit credit = new CustomerCredit(); + if (first) { + credit.setId(3); + first = false; + } else { + credit.setId(incrementer++); + } + + // This works! +// credit.setId(incrementer++); + credit.setName("customer5"); + credit.setCredit(new BigDecimal("100.00")); + + HibernateTemplate template = new HibernateTemplate(sessionFactory); + template.persist(credit); + } + +} Index: samples/src/main/resources/business-schema-hsqldb.sql =================================================================== --- samples/src/main/resources/business-schema-hsqldb.sql (revision 9035) +++ samples/src/main/resources/business-schema-hsqldb.sql (working copy) @@ -23,7 +23,7 @@ CREATE TABLE CUSTOMER ( ID INTEGER PRIMARY KEY, VERSION BIGINT, - NAME VARCHAR(45), + NAME VARCHAR(45) NOT NULL, CREDIT FLOAT ); Index: samples/src/main/resources/CustomerCredit.hbm.xml =================================================================== --- samples/src/main/resources/CustomerCredit.hbm.xml (revision 9035) +++ samples/src/main/resources/CustomerCredit.hbm.xml (working copy) @@ -6,10 +6,10 @@ - + - + Index: samples/src/main/resources/jobs/hibernateJob.xml =================================================================== --- samples/src/main/resources/jobs/hibernateJob.xml (revision 9035) +++ samples/src/main/resources/jobs/hibernateJob.xml (working copy) @@ -11,12 +11,29 @@ Example for Hibernate integration. - - + + + - - + + + + + + + + + + + + + + + + + @@ -37,8 +54,42 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +