Announcement Announcement Module
Collapse
No announcement yet.
How to implement dynamic queries on an inputsource Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to implement dynamic queries on an inputsource

    We use a HibernateCursorInputSource. How should we implement a more dynamic queryString?

    Should we subclass the HibernateCursorInputSource and override the queryString?

    Geir


    Code:
        <!-- input source -->
        <bean id="hibernateSubscriptionRollbackJobInputSource"
              class="org.springframework.batch.io.cursor.HibernateCursorInputSource" lazy-init="true">
    
            <property name="sessionFactory" ref="sessionFactoryCoreAb"/>
            <!-- INFO: eventCodeId = 3 is EventCode.DEACTIVATE id -->
            <property name="queryString"
                      value="from EventBean where eventDate &lt;= CURRENT_DATE and timeProcessed is null and eventCodeId = 3"/>
        </bean>

  • #2
    What do you mean by dynamic query string? Could you use a factory for the hql statement?

    Comment


    • #3
      It looks like you posted some code. I'm assuming you want to use some runtime parameters in your HQL. It's a similar problem as what was posted in this thread:

      http://forum.springframework.org/showthread.php?t=50008

      As with the SQL case mentioned in the thread, I would use either a PropertyPlaceHolderConfigurer, or potentially some type of factory for the HQL that is StepContextAware and can pull JobParameters out

      Comment

      Working...
      X