aspose file tools
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
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply 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: 8141
    
  52

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: 8141
    
  52

"ngpramod ngpramod"

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