This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes How to create query with jpa, getting exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to create query with jpa, getting exception" Watch "How to create query with jpa, getting exception" New topic
Author

How to create query with jpa, getting exception

Pramod Kumar
Ranch Hand

Joined: Oct 05, 2007
Posts: 40
Hi,

I am using the following query to access the db values in to the list

Query qury = em.createQuery("SELECT usr FROM User");
List<User> results = (List <User> qury.getResultList();

User is a bean mapped to user table.

I am getting the follwing exception

java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.IdentNode
\-[IDENT] IdentNode: 'usr ' {originalText=usr}

Thanks,
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9953
    
163

Query qury = em.createQuery("SELECT usr FROM User");


Change it to



The alias usr wasn't defined


[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9953
    
163

"ngpramod ngpramod"

Please check your private message, for a message from JavaRanch.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to create query with jpa, getting exception
 
Similar Threads
java.lang.NoClassDefFoundError: org/apache/tomcat/util/buf/B2CConverter
entityManager executing statements on system tables?
SelectItems + IllegalArgumentException + help
org.hibernate.QueryException: Expected positional parameter count: 2, actual parameters: [1]
Tomcat 6 + jdbc + Oracle