File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Duplicate class/entity mapping error 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 "Duplicate class/entity mapping error" Watch "Duplicate class/entity mapping error" New topic
Author

Duplicate class/entity mapping error

Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
Hi all,
I am creating a new Hibernate project. In my SessionFactory class I call the following method to read my hibernate.cfg.xml file....

configuration.configure("/hibernate-esong.cfg.xml");

However this throws the following exception....




Here is my hibernate-esong.cfg.xml.......





Here is my ESongBulkFile.hbm.xml.....




I am running this on JBoss 4 and both of these XML files are in the WEB-INF/classes folder of my web application.

Thanks in advance for any help.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

That error means you are trying to map an entity twice. Check the configuration file(s) in your classpath - is ESongBulkFile.hbm.xml mapped more than once? Or do you have another mapping file that uses the same class? Or are you calling the configure method more than once?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
I found the problem. In the hbm file the property called "originalFilename" is repeated twice. I know this is my mistake, but Hibernate gave me a really bad error message. It really threw me off.

Thanks anyway for your help.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9910
    
158

Originally posted by Jehan Jaleel:
In the hbm file the property called "originalFilename" is repeated twice. I know this is my mistake, but Hibernate gave me a really bad error message.



I agree. Maybe you should open a thread in the Hibernate forum and bring this to the notice of Hibernate developers who visit those forums regularly.


[My Blog] [JavaRanch Journal]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Duplicate class/entity mapping error
 
Similar Threads
hibernate error
Joins using Hiberntes
Hibernate: Executing stored procedure using hibernate
duplicate Mapping Exception : duplicate collection role mapping
InvalidMappingException