Announcement Announcement Module
Collapse
No announcement yet.
Chaning a HibernateItem writer to use step scope, stop onskip events? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Chaning a HibernateItem writer to use step scope, stop onskip events?

    I've got an implementation of HibernateItemWriter i'd like to put some job parameters into, but when I set scope="step" on the writer the @OnSkipInProcess event we have set up on the itemProcessor defined in the step are not longer triggered.

    Code:
    <bean class="org.springframework.batch.core.scope.StepScope">
            <property name="proxyTargetClass" value="true" />
    </bean>
    
    
    <step id="assetLoad">
         <tasklet>
            <chunk reader="assetFileReader" processor="assetProcessor" writer="assetLoader"  commit-interval="10"  skip-limit="1000000">
    	
           <skippable-exception-classes>
                  <include class="java.lang.Exception"/>
                  <include class="java.beans.IntrospectionException"/>
    	</skippable-exception-classes>
    	</chunk>
         </tasklet>
    </step>
    
    <bean id="assetLoader" class="batch.job.AssetHibernateItemWriter">
              <property name="proxySessionFactory" ref="sessionFactory" />
              <property name="logId"  value="#{jobParameters['logId']}" />
    </bean>
    What we have done here is set a custom method on the writer to explicitly set the hibernate template use as this wasn't being picked up on the doWrite method.

    But I'm unclear on why the @OnSkipInProcess method on the asset processor is no longer being called.

  • #2
    Originally posted by rtiffin View Post
    But I'm unclear on why the @OnSkipInProcess method on the asset processor is no longer being called.
    No reason I can think of. Can you find the problem?

    Comment

    Working...
    X