Use jobParameters value in HibernateCursorItemReader HQL

October 8, 2010 at 5:03 pm | Posted in Uncategorized | 4 Comments
Tags: , ,

When ItemReader, ItemWriter, or ItemProcessor need to use JobParameters, you can set their bean scope to “step” and able to reference parameters.

  • doesn’t need to use spring3
  • bean needs to be a “step” scope.
  • expressions are  “#{}” or “%{}”.
    impl is : org.springframework.batch.core.scope.StepScope.ExpressionHider

Here, I pass “from_date” as jobParameter, and bind it to the item reader HQL of HibernateCursorItemReader.

  <bean id="hibernateReader"
    <property name="sessionFactory" ref="sessionFactory"/>
    <property name="queryString">
          <![CDATA[ from Something where start_date <= :reqFromDate ]]>
    <property name="parameterValues">
        <entry key="reqFromDate" value="#{jobParameters['from_date']}"/>


RSS feed for comments on this post. TrackBack URI

  1. This was really helpful for me, thanks for the great post 🙂

  2. Thank you. Really helpful.

  3. Thanks for the post, it resolved my issue

  4. Thanks a lot, this worked like charm, very helpful

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at
Entries and comments feeds.

%d bloggers like this: