title: JPA add seconds to date in query
body: <p>I have a table called "Task" which has, among others, two columns: </p>
  
  <ul>
  <li>Date_due: a TIMESTAMP date</li>
  <li>Wait_in_seconds: a number (INT) of seconds</li>
  </ul>
  
  <p>I want to add the Wait_in_seconds value to the date in the query and compare it to the current date.</p>
  
  <p>The query below doesn't have the right syntax, but it indicates what I want:</p>
  
  <pre><code>SELECT t
  FROM Task t
  WHERE (Date_due + Wait_in_seconds) &lt; CURRENT_TIMESTAMP
  </code></pre>
  
  <p><strong>Edit:</strong> KIMI explains that this is not possible with JPQL. </p>
  
  <p><strong>Edit 2:</strong> This native MySQL query does the trick:</p>
  
  <pre><code>SELECT *, DATE_ADD(task.date_due, INTERVAL task.wait_seconds SECOND) AS dueDate
  FROM task                   
  HAVING dueDate &lt; NOW()
  ORDER BY dueDate ASC
  </code></pre>