title: JPA 2 Criteria Day from date
body: <p>I have a field in a table and that stores a date. I'd like to select all records that which the date is on day 5.</p>
  
  <p>After a lot of research I get the code below:</p>
  
  <pre><code>    Predicate dayValue = cb.equal(cb.function("day", Integer.class, test.&lt;Date&gt;get(Test_.dateInit)), now.get(Calendar.DAY_OF_MONTH) );
  </code></pre>
  
  <p>But, I'm using a Oracle database and it doesn't have the function day:</p>
  
  <pre><code>[EL Warning]: 2013-01-14 11:51:08.001--UnitOfWork(23011228)--Thread(Thread[main,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.2.v20101206-r8635): org.eclipse.persistence.exceptions.DatabaseException
  Internal Exception: java.sql.SQLException: ORA-00904: "DAY": invalid identifier
  </code></pre>
  
  <p>Is there an other way to do this select?</p>
  
  <p>Thanks</p>