File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create query with jpa, getting exception

 
Pramod Kumar
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Query qury = em.createQuery("SELECT usr FROM User");


Change it to



The alias usr wasn't defined
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"ngpramod ngpramod"

Please check your private message, for a message from JavaRanch.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic