
Originally Posted by
Dave Syer
I'm confused. You want to do something with a compound record that summarises the whole step? I assume you are using a StepExecutionListener? Really you need to provide more detail. Are you using a HibernateTransactionManager?
Dave,
I'm using HibernateTransactionManager .
I'm not doing anything with compound record, im dealing with only one record.
My itemReader initially reads from TABLE1 which has transactionId, status, date. According to my understanding in a step, all the records will be read one by one by the Item reader.
My requirement is i'll read one record from TABLE1 and at the end of the step i need to update the status in TABLE1 as COMPLETE (Same as framework tables).
This is applicable for all the records that is present in TABLE1.
Im using StepExecutionListener to log the exceptions alone.
Find my configuration
Code:
<bean id="mpChangeJob" parent="simpleJob">
<!-- set restartable=false so that this job can be used by more than one test -->
<property name="restartable" value="true" />
<property name="steps">
<bean id="mpChange" parent="skipLimitStep">
<property name="skipLimit" value="1"/>
<property name="itemReader" ref="hibernateItemReader" />
<property name="itemWriter" ref="hibernateItemWriter" />
<property name="commitInterval" value="1" />
<property name="skippableExceptionClasses" value="java.lang.Exception"/>
<property name="exceptionHandler" ref="exceptionHandler" />
<property name="allowStartIfComplete" value="true" />
<property name="listeners">
<list>
<ref bean="skipStepListener"/>
<ref bean="stepListener"/>
</list>
</property>
</bean>
</property>
</bean>
<!-- This is a framework class that needs a delegate and also needs to be registered as a RepeatInterceptor in the chunk -->
<bean id="hibernateItemWriter"
class="org.springframework.batch.item.database.HibernateAwareItemWriter">
<property name="sessionFactory" ref="sessionFactory" />
<property name="delegate" ref="epiProcessor" />
</bean>
<bean id="epiProcessor"
class="com.met.ib.upi.batch.item.processor.MPChangeProcessor">
<property name="mpchangeBO" ref="mpchangeBO" />
<property name="appDS" ref="appDS"/>
</bean>
<bean id="writerDAO"
class="com.met.ib.upi.batch.item.writer.EPIWriter">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="readerDAO"
class="com.met.ib.upi.batch.item.reader.EPIReader">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="mpchangeBO"
class="com.met.ib.upi.batch.bo.MPChangeBO">
<property name="writerDAO" ref="writerDAO" />
<property name="readerDAO" ref="readerDAO" />
</bean>
<bean id="hibernateItemReader"
class="org.springframework.batch.item.database.HibernateCursorItemReader">
<property name="queryString" value="from StgTable where tranSttsCd=2 and procDt=current_date" />
<property name="fetchSize" value="1" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="appDS"
class="com.met.ib.upi.batch.item.writer.ApplicationMetaDataService">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="stepListener"
class="com.met.ib.upi.batch.listener.StepExceptionListener">
<property name="writerDAO" ref="writerDAO" />
</bean>
<bean id="skipStepListener" class="com.met.ib.upi.batch.listener.SkipStepListener">
<property name="writerDAO" ref="writerDAO" />
</bean>
<bean id="exceptionHandler" class="com.met.ib.upi.batch.listener.EPIExceptionHandler">
</bean>
<!-- the transactional semantics...-->
<tx:advice id="txJobAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="execute*" rollback-for="java.lang.Exception"/>
<tx:method name="onSkipInWrite*" propagation="REQUIRES_NEW" isolation="SERIALIZABLE" />
<tx:method name="logError*" propagation="REQUIRES_NEW" isolation="SERIALIZABLE" />
<tx:method name="onWriteError*" propagation="REQUIRES_NEW" isolation="READ_COMMITTED" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:advisor pointcut="execution(* com.met.ib.upi.batch.listener.SkipStepListener.*(..))"
advice-ref="txJobAdvice" />
<aop:advisor pointcut="execution(* com.met.ib.upi.batch.listener.StepExceptionListener.*(..))"
advice-ref="txJobAdvice" />
</aop:config>

Originally Posted by
Dave Syer
You are aware that using the map repository means you won't be able to restart failed jobs across JVM boundaries?
Can you explain why i won't be able to restart my failed job across JVM boundaries?
I just don't want the framework tables also i want to run my jobs again and again any number of times irrespective of its status.