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