users@glassfish.java.net

Re: JPA problem with Timestamp

From: <glassfish_at_javadesktop.org>
Date: Thu, 20 Nov 2008 09:54:04 PST

Herer is a native query that will probably work

Query query = em.createNativeQuery("SELECT id FROM table WHERE MONTH( DATE(timestamp1) - DATE(timestamp2) ) > 3 ");

List resultRows = query.getResultList();
for (Iterator it = resultRows.iterator(); it.hasNext(); ) {
    Vector resultRow = (Vector) it.next();
    Integer id = (Integer) resultRow.elementAt(0);
    ...
}
[Message sent by forum member 'bbergquist' (bbergquist)]

http://forums.java.net/jive/thread.jspa?messageID=317899