wood burning stoves*
The moose likes Object Relational Mapping and the fly likes My class is not mapped Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "My class is not mapped" Watch "My class is not mapped" New topic
Author

My class is not mapped

David Brossard
Ranch Hand

Joined: Jun 03, 2004
Posts: 109
Hi cowboys,


I've an odd problem with my hibernate. I've mapped it to a class and can easily do inserts. However when it comes to doing a select, hibernate complains my given class isn't mapped.

The class code itself is as simple as it gets: it contains 4 attributes and the corresponding getters / setters. The class also contains a static method used to generate uuids.

My config file includes:



And the contents of Federation.hbm.xml are:


My db table is as follows (mysql):


My class attributes and getters / setters:


So where have I erred?

Thanks for your help...


No matter what they say in Ohio, we're still first in flight!
Jonathan Huang
Ranch Hand

Joined: Jun 23, 2006
Posts: 35
Could you post the calling code and stacktrace? Off hand I don't see anything wrong with your code/mappings.
David Brossard
Ranch Hand

Joined: Jun 03, 2004
Posts: 109
the stack trace:



Actually the insert works fine. Only the listing (method listItems) doesn't work which probably means I made a mistake there. I'll try to figure it out and update this thread hopefully.
David Brossard
Ranch Hand

Joined: Jun 03, 2004
Posts: 109
the problem is that when I executed my select query in HQL, I gave the sql table name rather than the java class name as the from attributes e.g. from federations (my sql table) rather than from federation (my class).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: My class is not mapped
 
Similar Threads
Hibernate insert or select gives "Identifier of an instance altered"
HIBERNATE hql.ast.QuerySyntaxException: (table name) is not mapped
Foreign Key Constraint Fails
Hibernate mapping
Hibernate parent/child and foreign key relationships mapping