-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: org.hibernate.DuplicateMappingException
PostPosted: Thu Jan 24, 2008 5:43 am 
Newbie

Joined: Thu Jan 24, 2008 5:12 am
Posts: 2
I'm new to hibernate and getting duplicate mapping exception while creating session? Exception occured after restarting application server. Can anyone help me to solve this problem?

%%%% Error Creating SessionFactory Default %%%%
org.hibernate.MappingException: Could not read mappings from resource: com/turkcell/apps/giftapp/model/entity/GftMainProcess.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:484)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1443)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1411)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1392)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1368)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1288)
at com.turkcell.core.database.factory.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:101)
at com.turkcell.core.database.dao.CoreHibernateDao.currentSession(CoreHibernateDao.java:35)
at com.turkcell.core.database.dao.CoreHibernateDao.commitAllTxns(CoreHibernateDao.java:80)
at com.turkcell.common.servletfilters.CoreHibernateFilter.doFilter(CoreHibernateFilter.java:53)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6458)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: org.hibernate.DuplicateMappingException: Duplicate collection role mapping com.turkcell.apps.giftapp.model.entity.GftMainProcess.gftSubProcessMap
at org.hibernate.cfg.Mappings.addCollection(Mappings.java:123)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1965)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1940)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:324)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:238)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:109)
at org.hibernate.cfg.Configuration.add(Configuration.java:385)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:426)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:481)
... 17 more

GftMainProcess.hbm.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE hibernate-mapping (View Source for full doctype...)>
- <!-- DO NOT EDIT: This is a generated file that is synchronized
-->
- <!-- by MyEclipse Hibernate tool integration.
-->
- <!-- Created Wed Nov 09 19:08:00 EET 2005
-->
- <hibernate-mapping package="com.turkcell.apps.giftapp.model.entity" default-cascade="none" default-access="property" default-lazy="true" auto-import="true">
- <class name="GftMainProcess" table="GFT_MAIN_PROCESS" schema="INTRAPPS" mutable="true" polymorphism="implicit" dynamic-update="false" dynamic-insert="false" select-before-update="false" optimistic-lock="version">
- <id name="processId" column="PROCESS_ID" type="java.lang.Long">
- <generator class="sequence">
<param name="schema">intrapps</param>
<param name="sequence">GFT_MAIN_PROCESS_ID_SEQ</param>
</generator>
</id>
<property name="processType" column="PROCESS_TYPE" type="java.lang.String" not-null="true" unique="false" optimistic-lock="true" lazy="false" generated="never" />
<property name="processDesc" column="PROCESS_DESC" type="java.lang.String" not-null="true" unique="false" optimistic-lock="true" lazy="false" generated="never" />
- <map name="gftSubProcessMap" inverse="true" cascade="all-delete-orphan" lazy="false" fetch="join" mutable="true" sort="unsorted" optimistic-lock="true" embed-xml="true">
<key column="PROCESS_ID" not-null="true" on-delete="noaction" />
<map-key formula="SUB_PROCESS_ID" type="long" />
<one-to-many class="GftSubProcess" not-found="exception" embed-xml="true" />
</map>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 6:15 am 
Newbie

Joined: Tue Jan 15, 2008 10:07 am
Posts: 14
You aren't by any chance adding the same mapping to the Hibernate configuration twice?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 6:26 am 
Newbie

Joined: Thu Jan 24, 2008 5:12 am
Posts: 2
No, I have double-checked it.


Top
 Profile  
 
 Post subject: DuplicateMappingException Duplicate collection role mapping
PostPosted: Mon Feb 04, 2008 12:54 pm 
Newbie

Joined: Mon Feb 04, 2008 12:27 pm
Posts: 1
I'm new to hibernate, and I'm suddenly having a similar issue...


Caused by: org.hibernate.DuplicateMappingException: Duplicate collection role mapping ebookdata.EbkBook.ebkRecords
at org.hibernate.cfg.Mappings.addCollection(Mappings.java:124)


My web app was working fine and suddenly it started throwing this exception. I noticed a couple of interesing things.

ONE:
This issue came up suddenly after I created some mappings and classes by reverse engineering and created a handful of classes. This new stuff is not mentioned in the exception. Interestingly, the referenced mapping is the FIRST mapping in my config file, thefirst one I created.

When I changed the order of the config file, it then references the new FIRST mapping. This makes me think that the mappings are somehow being read twice. I don't see how.

TWO:
When I restored my classes and mappings from before I had the issue, it did not go away. This restore did not include the workspace .metadata folder which I discovered was not being versioned.

Any thoughts?? This is driving me crazy. I'm trying to debug it but I'm just learning how at this point.

_________________
Kurt Umholtz
The Parker River Group, Inc.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.