• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Duplicate class/entity mapping error

 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic