users@glassfish.java.net

Load entities with CreateNativeQuery

From: <glassfish_at_javadesktop.org>
Date: Fri, 18 May 2007 16:44:48 PDT

hi,

is it possible to get an 'object' by em.createNativeQuery(query) ?

for example i have an entity such as 'user':

@Entity
public Class User {

//some attributes such as
public String value;
}

I tried to do:

Collection<User> em.createNativeQuery("select object(User) from USER_TABLE User where User.value = 'text').getResultList();


I get the following exception:
Internal Exception: java.sql.SQLException: Unknown column 'User' in 'field list'
Error Code: 1054
Call: SELECT object(User) from IDM_USER User
Query: DataReadQuery()


thanks
[Message sent by forum member 'demiant' (demiant)]

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