This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My class is not mapped

 
David Brossard
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Jonathan Huang
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you post the calling code and stacktrace? Off hand I don't see anything wrong with your code/mappings.
 
David Brossard
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic