File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Hibernate DuplicateMappingException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate DuplicateMappingException" Watch "Hibernate DuplicateMappingException" New topic

Hibernate DuplicateMappingException

Amit Goda
Ranch Hand

Joined: Jan 21, 2012
Posts: 37

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

Joined: Mar 07, 2010
Posts: 1682

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.

[How To Ask Questions][Read before you PM me]
Amit Goda
Ranch Hand

Joined: Jan 21, 2012
Posts: 37

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.

I agree. Here's the link:
subject: Hibernate DuplicateMappingException
It's not a secret anymore!