• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Duplicate class/entity mapping error

 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
He's my best friend. Not yours. Mine. You can have this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic