Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate DuplicateMappingException

 
Amit Goda
Ranch Hand
Posts: 37
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I am new to Hibernate. I am implementing Hibernate using JPA. Since i am using JPA there is no .cfg.xml or .hbm.xml file in my configuration(those files were present before but i deleted them). Even though there is no mapping file my classes i am getting exception for one of my login.OwnerLogin class org.hibernate.DuplicateMappingException: Duplicate class/entity mapping login.OwnerLogin. Even in my persistence .xml there is no mapping. Can anyone please tell me the cause of the following exception



and my persistence.xml file is as follows

 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You apparently have some other configuration file somewhere. You are getting warnings like the ones I listed below and those namespaces are not used in the persistence.xml you have listed:



My guess is somewhere in there exists a duplicate mapping for OwnerLogin.


I thought you said you don't have any hbm.xml files?




You might want to clean out your webapp directory and verify that the files you deleted are really gone in the WAR you are deploying.
 
Amit Goda
Ranch Hand
Posts: 37
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply.

As you said my application is referencing unknown files, you are correct. Before posting i removed all the traces for the hbm and cfg files. I even cleared the cache from eclipse in case if its referencing from there and also i disabled caching but still had the problem. I even deleted the WAR file and deployed new one. But what i didn't do is clearing it from the webapps directory from where it is being referenced.

You are absolutely correct. I had those files present in my webapps directory. Thank you for pointing in the right direction. You were of great help.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic