This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "My class is not mapped" Watch "My class is not mapped" New topic

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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: My class is not mapped
It's not a secret anymore!