users@glassfish.java.net

Re: Load entities with CreateNativeQuery

From: <glassfish_at_javadesktop.org>
Date: Fri, 18 May 2007 17:20:12 PDT

Hi demiant,

The Object(...) notation should only be used in JP QL. Native queries will be executed "as is" against the database. The same query in JP QL would be:

Collection <User> c = em.createQuery("select object(u) from User u where u.value = 'text').getResultList();

Please also see section 3.6.6 SQL Queries in the JPA spec for native query examples.
[Message sent by forum member 'mf125085' (mf125085)]

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