Results 1 to 3 of 3

Thread: How to implement dynamic queries on an inputsource

  1. #1

    Default 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. #2
    Join Date
    Dec 2006
    Posts
    1,061

    Default

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

  3. #3
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •