users@glassfish.java.net

Re: JPA problem with Timestamp

From: <glassfish_at_javadesktop.org>
Date: Thu, 20 Nov 2008 06:23:25 PST

You are trying to do a SQL query instead of JPA query. JPA works on Entity classes and properties and not tables and columsn. Since you did not show the class in your post, I will assume it is something like Foo. So you query would be something like:

Query query = em.createQuery("SELECT f.id FROM Foo f WHERE MONTH( DATE(f.timestamp1) - DATE(f.timestamp2) ) > 3 ")
[Message sent by forum member 'bbergquist' (bbergquist)]

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