The moose likes Object Relational Mapping and the fly likes Problem of Unknown Entity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem of Unknown Entity" Watch "Problem of Unknown Entity" New topic

Problem of Unknown Entity

SanjayR Jain
Ranch Hand

Joined: Mar 05, 2009
Posts: 43
I have added hbm.xml mapping in hibernate.cfg.xml. But it is not reading this hbm file during run time and giving me below exception.

Om Tejas

Joined: Dec 02, 2009
Posts: 27
The exception suggests that the class file mentioned in .cfg.xml and .hbm file is not correct. May be a spelling mistake. Verify this.

If this not solved your problem , post your hibernate.cfg.xml file and .hbm file.

David Newton

Joined: Sep 29, 2008
Posts: 12617

Or the T&C class isn't being deployed.
SanjayR Jain
Ranch Hand

Joined: Mar 05, 2009
Posts: 43
Here is my .cfg.xml file

Here is my termandcondition.hbm.xml fie

As you can see I have added my termandcondition.hbm.xml file in .cfg.xml file in the last.
All other .hbm working fine.

And for the I have putted a jar file on th server side where all the hbm files putted.

SanjayR Jain
Ranch Hand

Joined: Mar 05, 2009
Posts: 43
What I really want to do that to save an new in to the database.
For that I just made a new instance in my dao class and called the method saveOrUpdate of the session.
Then it is giving error which I posted in my first post.
i.e. My .cfg.xml is not getting the termandcondition.hbm.xml

Now what I did is in my TermAndCondition bean class I made a default constructor.Now it wrking properly.
But this is bit of confusing for me Because need of constructor will be at the time of making new instance for saving.Not at the time
when searching of .hbm.xml in the cfg.xml file.

Si how it is working properly?
I agree. Here's the link:
subject: Problem of Unknown Entity
jQuery in Action, 3rd edition