[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Hibernate MappingException "Unknown entity" with only one hb

jimmarks do-not-reply at jboss.com
Wed Dec 10 22:12:23 EST 2008


I am constructing a proof of concept for my organization as we plan out the new structure for a web-based application. While I have a fair bit of Java experience and a fair bit of web-based application experience, this is my first attempt at a properly structured, Java-based, web-based application. It is also the first of these for my organization (previous version is ASP/.Net). The learning curve has been steep, but I am nearly there. One (apparent) hurdle remains. I will try to describe my environment in as much detail as possible.

JBoss 4.2.3.GA
Hibernate 3 (whatever is bundled into the above JBoss)
Spring 2.5.5

Because our application will eventually be quite substantial and complex, I have been attempting to use a .har file, which includes the hibernate-service.xml as well as the *.hbm.xml files, rather than using a hibernate.cgf.xml and then explicitly listing all the .hbm.xml files in the bean definition within the applicationContext.xml file. Since my ant build script can literally say *.hbm.xml but I (and all the other developers) would have to remember to add a new line to the bean definition every time we added a class with the other approach.

When I build my .ear file, it includes the .har file (which includes the hibernate-service.xml and the *.hbm.xml files) and the .war file which contains the application itself. There is also a META-INF folder which contains a jboss-app.xml (describing the .har file) and an application.xml file (describing the .war file).

When I deploy my .ear file, I can watch JBoss deploying Hibernate (from the .har I assume?), and it throws an org.hibernate.MappingException "Unknown Entity" on the one and only class from the one and only .hbm.xml file during this deployment. The .ear continues to deploy and my web-app is up and running. Obviously if I attempt to access it, I get a much more serious error, because the application attempts to make use of a Hibernate binding that now doesn't exist.

The hbm.xml file in question is very simple and appears to be syntactically correct. I have to conclude that JBoss is finding this .hbm.xml file or how else would it be able to throw this kind of exception at deployment rather than runtime?

I don't know what additional information details to provide to illuminate for someone more experienced than myself to see what the problem may be.

Any help would be greatly appreciated, thanks. 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4195777#4195777

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4195777



More information about the jboss-user mailing list