Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Querying in JPA

 
Mahendra Kariya
Greenhorn
Posts: 26
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created two entity classes from database:Users and Dictionary using the wizard. Next I was trying to query the DB. In another class, in the main method, I just typed in this code.


When I am running this class, I am getting an exception. Exception Description is

Where is the problem?
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most likely, you have either not registered the Users class with the persistence unit (ensure it is listed in your persistence.xml),
or have set the Users "name" to something other than "Users".

Please include your persistence.xml, and Users class.
 
Mahendra Kariya
Greenhorn
Posts: 26
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James Sutherland wrote:Most likely, you have either not registered the Users class with the persistence unit (ensure it is listed in your persistence.xml)

Thanks. This worked. Users class was not registered in persistence unit. A silly mistake!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic