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