-->
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.  [ 6 posts ] 
Author Message
 Post subject: DupplicateMapping Exception
PostPosted: Sun Feb 14, 2010 10:43 pm 
Newbie

Joined: Sun Feb 14, 2010 10:17 pm
Posts: 5
working with persistence unit

I've got a persistence error message about duplicate mapping exception
I've try to debug, but still come to dead end

Hope here I can get some insight

here is my pojo class
Code:
package xyzproject.model.business;
import xyzproject.model.AbstractPersistentClass;



public class Module extends AbstractPersistentClass {
   private static final long serialVersionUID = 1L;

   String   name;
   String    description;
   String    uiName;

   String   entityName;
   boolean   uiActive;
   String   iconPath;
   String   status;
   int      viewOrder;


   public Module() {
      super();
   }
   
   public Module(String name) {
      super();
      this.name = name;
   }
   

   public Module(String name, String entityName) {
      super();
      this.name = name;
      this.uiName = name;
      this.entityName = entityName;
   }

   public Module(String name, String description, String uiName,
         String entityName, boolean uiActive, String iconPath,
         String status, int viewOrder) {
      super();
      this.name = name;
      this.description = description;
      this.uiName = uiName;
      this.entityName = entityName;
      this.uiActive = uiActive;
      this.iconPath = iconPath;
      this.status = status;
      this.viewOrder = viewOrder;
   }

   public String getDescription() {
      return description;
   }
   
   public boolean isUiActive(){
         return uiActive;
   }

   public String getIconPath() {
      if (iconPath == null)
         return "/modules/" + name + "/view/" + name + ".jpg";
      return iconPath;
   }

   public String getName() {
      return name;
   }

   public String getStatus() {
      return status;
   }


   public String getUiName() {
      return uiName;
   }

   public int getViewOrder() {
      return viewOrder;
   }

   
   public void setDescription(String description) {
      this.description = description;
   }

   public void setIconPath(String iconPath) {
      this.iconPath = iconPath;
   }

   public void setName(String name) {
      this.name = name;
   }

   public void setStatus(String status) {
      this.status = status;
   }

   public void setUiActive(boolean uiActive) {
      this.uiActive = uiActive;
   }

   public void setUiName(String uiName) {
      this.uiName = uiName;
   }

   public void setViewOrder(int viewOrder) {
      this.viewOrder = viewOrder;
   }

   public String getEntityName() {
      return entityName;
   }

   public void setEntityName(String entityName) {
      this.entityName = entityName;
   }

}

abstractpersistenceclass just abstract class that define the Id
( common field and implements Serialilize )


and it's mapping hbm.xml file
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 19 Jan 10 11:48:51 by Hibernate Tools 3.2.5.Beta -->
<hibernate-mapping>
<class name="xyzproject.model.business.Module"
       entity-name="Module"
       table="modules">
       
      <id type="long" column="module_id">           
         <generator class="native"/>
      </id>
      
      <property name="name" type="string" unique="true" not-null="true" length="25">
         <column name="module_name"/>
      </property>
      <property name="description" type="string" >
         <column name="module_description"/>         
      </property>
      <property name="uiName" type="string" >
         <column name="module_uiName"/>
      </property>
      
      <property name="entityName" type="string" unique="true">
         <column name="module_class"/>
      </property>
      <property name="uiActive" type="boolean" >
         <column name="module_uiactive"/>
      </property>      
      <property name="iconPath" type="string" >
         <column name="module_icon"/>
      </property>
      <property name="status" type="string">
         <column name="module_status"/>
      </property>      
      <property name="viewOrder" type="integer" unique="true">
         <column name="module_uiOrder"/>
      </property>   
</class>
</hibernate-mapping>



my hibernate config cfg.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="xyzprojectSessionFactory">
<!- some connection definitions -->
      
      <property name="hibernate.hbm2ddl.auto">none</property>
      <property name="auto-import">false</property>
      <property name="hibernate.generate_statistics">true</property>

      
      <property name="hibernate.archive.autodetection"></property>
      <property name="hibernate.ejb.autodetection">hbm</property>      
      
      
<!-- and I've commented these imports, but the exception persist -->      
<!--
      <mapping resource="xyzproject/model/entity/Address.hbm.xml" />
      <mapping resource="xyzproject/model/entity/Company.hbm.xml" />

      <mapping resource="xyzproject/model/entity/Consultant.hbm.xml" />
      <mapping resource="xyzproject/model/entity/Contact.hbm.xml" />
      <mapping resource="xyzproject/model/entity/Department.hbm.xml" />
      <mapping resource="xyzproject/model/entity/Employee.hbm.xml" />
      <mapping resource="xyzproject/model/entity/Project.hbm.xml" />
      <mapping resource="xyzproject/model/entity/Task.hbm.xml" />   

      <mapping resource="xyzproject/model/business/AccessControlList.hbm.xml" />
      <mapping resource="xyzproject/model/business/AuditTrail.hbm.xml" />
      <mapping resource="xyzproject/model/business/Module.hbm.xml" />
      <mapping resource="xyzproject/model/business/Role.hbm.xml" />
      <mapping resource="xyzproject/model/business/Session.hbm.xml" />       
      <mapping resource="xyzproject/model/business/User.hbm.xml" />
-->      
      
</session-factory>
</hibernate-configuration>


does anyone here can show me where I've gone wrong ???


Top
 Profile  
 
 Post subject: Re: DupplicateMapping Exception
PostPosted: Sun Feb 14, 2010 10:47 pm 
Newbie

Joined: Sun Feb 14, 2010 10:17 pm
Posts: 5
and for those who not convinced to the problem
here is the stacktrace
Quote:
2010-02-14 23:50:03,781 INFO [org.hibernate.ejb.Version] (HDScanner) Hibernate EntityManager 3.4.0.GA
2010-02-14 23:50:03,859 INFO [org.hibernate.ejb.Ejb3Configuration] (HDScanner) Processing PersistenceUnitInfo [
name: xyzprojectPU
...]
2010-02-14 23:50:47,093 WARN [org.hibernate.ejb.Ejb3Configuration] (HDScanner) Persistence provider caller does not implement the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
2010-02-14 23:50:47,171 INFO [org.hibernate.cfg.Configuration] (HDScanner) configuring from resource: hibernate.cfg.xml
2010-02-14 23:50:47,171 INFO [org.hibernate.cfg.Configuration] (HDScanner) Configuration resource: hibernate.cfg.xml
2010-02-14 23:50:47,328 INFO [org.hibernate.cfg.Configuration] (HDScanner) Configured SessionFactory: xyzprojectSessionFactory
2010-02-14 23:50:48,125 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: Module -> modules
2010-02-14 23:50:48,156 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: Project -> projects
2010-02-14 23:50:48,578 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping collection: Project.contacts -> project_contacts
2010-02-14 23:50:48,578 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: AccessControlList -> permissions
2010-02-14 23:50:48,609 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: User -> users
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: Department -> departments
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: AuditTrail -> audittrail
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: Address -> addresses
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: Skill -> skill
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: Role -> roles
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: Company -> companies
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: Session -> sessions
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: Contact -> contacts
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: Task -> tasks
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping collection: Task.departments -> task_departements
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping collection: Task.contacts -> task_contacts
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.Mappings] (HDScanner) duplicate import: Module->Module
2010-02-14 23:50:48,625 INFO [org.hibernate.cfg.HbmBinder] (HDScanner) Mapping class: Module -> modules

2010-02-14 23:50:48,625 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (HDScanner) Error installing to Start: name=persistence.unit:unitName=xyzproject.ear/xyzproject.jar#xyzprojectPU state=Create
org.hibernate.DuplicateMappingException: Duplicate class/entity mapping Module
at org.hibernate.cfg.Mappings.addClass(Mappings.java:141)

at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:167)
at org.hibernate.cfg.Configuration.add(Configuration.java:702)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:531)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:291)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1148)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:173)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:425)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:131)
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
2010-02-14 23:50:48,718 INFO [org.jboss.jpa.deployment.PersistenceUnitDeployment] (HDScanner) Starting persistence unit persistence.unit:unitName=xyzproject.ear/xyzproject.war#xyzprojectPU
2010-02-14 23:50:48,718 INFO [org.hibernate.ejb.Ejb3Configuration] (HDScanner) Processing PersistenceUnitInfo [
name: xyzprojectPU
...]


Top
 Profile  
 
 Post subject: Re: DupplicateMapping Exception
PostPosted: Sun Feb 14, 2010 10:49 pm 
Newbie

Joined: Sun Feb 14, 2010 10:17 pm
Posts: 5
and please help me up and this issue ( it's already a week fighting this ) :hammer: :((


Top
 Profile  
 
 Post subject: Re: DupplicateMapping Exception
PostPosted: Mon Feb 15, 2010 12:12 am 
Newbie

Joined: Sun Feb 14, 2010 8:08 am
Posts: 12
I hope this might help https://forum.hibernate.org/viewtopic.php?t=957413&


Top
 Profile  
 
 Post subject: Re: DupplicateMapping Exception
PostPosted: Mon Feb 15, 2010 3:08 am 
Newbie

Joined: Sun Feb 14, 2010 10:17 pm
Posts: 5
thank you mpujari

but I don't think so.. :((

here is my proof
  • no @entity annotation on pojo class
  • mapping on cfg.xml file already commented
  • the effect should be only from <property name="hibernate.ejb.autodetection">hbm</property>


and even when
Code:
<property name="hibernate.ejb.autodetection"></property>

the problem persist, I don't know where import command take place


Top
 Profile  
 
 Post subject: Re: DupplicateMapping Exception
PostPosted: Wed Feb 24, 2010 11:27 pm 
Newbie

Joined: Sun Feb 14, 2010 10:17 pm
Posts: 5
expecting expert advice here... ??

are my explanation not clear enough ?
pleeeaaasee....


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.