AnsweredAssumed Answered

Custom 'next jobs' query for mysql

Question asked by etienne on Jan 19, 2012
Hi

When selecting the next jobs, why is there a custom sql query for MySQL (see Job.xm) that does not include the RETRIES column?

MySQL: 
   <select id="selectNextJobsToExecute_mysql" parameterType="string" resultMap="jobResultMap">
    select *
    from ACT_RU_JOB
    where (RETRIES_ &gt; 0)
      and (DUEDATE_ is null or DUEDATE_ &lt;= #{now, jdbcType=TIMESTAMP})
      and (LOCK_OWNER_ is null or LOCK_EXP_TIME_ &lt;= #{now, jdbcType=TIMESTAMP})
  </select>

All other DBs:
<select id="selectNextJobsToExecute" parameterType="string" resultMap="jobResultMap">
    select *
    from ACT_RU_JOB
    where (RETRIES_ &gt; 0)
      and (DUEDATE_ is null or DUEDATE_ &lt; #{now, jdbcType=TIMESTAMP})
      and (LOCK_OWNER_ is null or LOCK_EXP_TIME_ &lt; #{now, jdbcType=TIMESTAMP})
      and (RETRIES_ &gt; 0)
  </select>

Actually, I've just realized that these two statements do exactly the same thing. Hence, I've reported an issue to remove this duplication:
http://jira.codehaus.org/browse/ACT-1064

Regards, Etienne

Outcomes