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 Querying in JPA 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 "Querying in JPA" Watch "Querying in JPA" New topic
Author

Querying in JPA

Mahendra Kariya
Greenhorn

Joined: Aug 25, 2008
Posts: 26

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

Joined: Oct 01, 2007
Posts: 553
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.

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
Mahendra Kariya
Greenhorn

Joined: Aug 25, 2008
Posts: 26

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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Querying in JPA
 
Similar Threads
EntityManager is null when I try to use it straight from filter servlet
Unable to use @NamedQuery in a session bean?
Sequence increment does not match its pre-allocation size.
design decision: variation of session fassade
Error compiling the query. Unknown entity type [mlsUser]