-->
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.  [ 2 posts ] 
Author Message
 Post subject: Duplicate class/entity even with auto-import="false"
PostPosted: Tue Dec 08, 2009 10:21 am 
Beginner
Beginner

Joined: Fri Dec 04, 2009 9:37 am
Posts: 34
Hello,

I am working with Hyperjaxb3 Hibernate plugin and getting ever :
org.hibernate.DuplicateMappingException: Duplicate class/entity mapping myPackage.PurchaseOrderType
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:716)
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:1162)
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:191)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:253)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)

Is it not so that actually "auto-import=false" in the hbm should prevent class-analysing ???

my hybernate cfg is:
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>
      <mapping resource="myPackage/USAddress.hbm.xml"/>
      <mapping resource="myPackage/Items.hbm.xml"/>
      <mapping resource="myPackage/Item.hbm.xml"/>
      <mapping resource="myPackage/PurchaseOrderType.hbm.xml"/>
   </session-factory>
</hibernate-configuration>


->>> I also tried with removing all mapping elements in the hybernate.cfg, but its still the same Duplicate error, wehere no duplicates are..

The Log says :
INFO 08.12.09 14:51:26,828 [MThread-10] HbmBinder Mapping class: myPackage.PurchaseOrderType -> PurchaseOrderType
DEBUG 08.12.09 14:51:26,828 [MThread-10] HbmBinder Mapped property: Hjid -> Hjid
DEBUG 08.12.09 14:51:26,828 [MThread-10] HbmBinder Mapped property: ShipTo -> ShipTo
DEBUG 08.12.09 14:51:26,828 [MThread-10] HbmBinder Mapped property: BillTo -> BillTo
DEBUG 08.12.09 14:51:26,829 [MThread-10] HbmBinder Mapped property: Comment -> Comment
DEBUG 08.12.09 14:51:26,829 [MThread-10] HbmBinder Mapped property: Items -> Items
DEBUG 08.12.09 14:51:26,829 [MThread-10] HbmBinder Mapped property: OrderDate -> OrderDate
INFO 08.12.09 14:51:26,829 [MThread-10] HbmBinder Mapping class: myPackage.USAddress -> USAddress
DEBUG 08.12.09 14:51:26,829 [MThread-10] HbmBinder Mapped property: Hjid -> Hjid
DEBUG 08.12.09 14:51:26,829 [MThread-10] HbmBinder Mapped property: Name -> Name
DEBUG 08.12.09 14:51:26,829 [MThread-10] HbmBinder Mapped property: Street -> Street
DEBUG 08.12.09 14:51:26,830 [MThread-10] HbmBinder Mapped property: City -> City
DEBUG 08.12.09 14:51:26,830 [MThread-10] HbmBinder Mapped property: State -> State
DEBUG 08.12.09 14:51:26,830 [MThread-10] HbmBinder Mapped property: Zip -> Zip
DEBUG 08.12.09 14:51:26,830 [MThread-10] HbmBinder Mapped property: Country -> Country
INFO 08.12.09 14:51:26,830 [MThread-10] Mappings duplicate import: myPackage.PurchaseOrderType->myPackage.PurchaseOrderType
INFO 08.12.09 14:51:26,830 [MThread-10] HbmBinder Mapping class: myPackage.PurchaseOrderType -> PurchaseOrderType

Why does the HbmBinder gets the PurchaceOrderType twice ? the mapping says nothing about this..

a sample of the generated hbm's :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
  PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" default-cascade="all-delete-orphan" default-lazy="false">
   <class discriminator-value="myPackage.Items" name="myPackage.Items"
          table="Items">
      <id access="org.jvnet.hyperjaxb3.hibernate.accessor.CheckingPropertyAccessor"
          name="Hjid"
          type="org.hibernate.type.LongType">
         <generator class="native"/>
      </id>
      <discriminator type="org.hibernate.type.StringType">
         <column name="Hjtype"/>
      </discriminator>
      <list access="org.jvnet.hyperjaxb3.hibernate.accessor.ListAccessor" name="Item"
            table="Items_Item">
         <key>
            <column name="Items_Item_Hjid"/>
         </key>
         <list-index>
            <column name="Items_Item_Hjindex"/>
         </list-index>
         <one-to-many class="myPackage.Item"/>
      </list>
   </class>
</hibernate-mapping>


I think this is targetig to
http://opensource.atlassian.com/projects/hibernate/browse/EJB-43
.. hm but how to get it work ? In this issue is a <entity-manager> tag listed in persistence.xml. never seen before.-...


Any help welcome !

Regards, Andre


Top
 Profile  
 
 Post subject: Re: Duplicate class/entity even with auto-import="false"
PostPosted: Fri Dec 11, 2009 6:58 am 
Beginner
Beginner

Joined: Fri Dec 04, 2009 9:37 am
Posts: 34
like everytime - solved :

hibernate.archive.autodetection = ""
hibernate.ejb.autodetection = "hbm"


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