Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » teneo: Yet another DuplicateMappingException problem
teneo: Yet another DuplicateMappingException problem [message #601876] Wed, 31 January 2007 21:42
Brian Vetter is currently offline Brian VetterFriend
Messages: 74
Registered: July 2009
Member
I too am having a problem with a Duplicate<appingException being thrown. I have added the QUALIFY_ENTITY_NAME property with the value QUALIFY_ENTITY_NAME_NSPREFIX and still get the duplicate mapping exception. The complete exception trace is:

Exception in thread "main" org.hibernate.DuplicateMappingException: duplicate import: InterfaceCard refers to both cisco3800.InterfaceCard and types.InterfaceCard (try using auto-import="false")
at org.hibernate.cfg.Mappings.addImport(Mappings.java:141)
at org.hibernate.cfg.HbmBinder.bindPersistentClassCommonValues( HbmBinder.java:614)
at org.hibernate.cfg.HbmBinder.bindClass(HbmBinder.java:527)
at org.hibernate.cfg.HbmBinder.bindJoinedSubclass(HbmBinder.jav a:848)
at org.hibernate.cfg.HbmBinder.handleJoinedSubclass(HbmBinder.j ava:2202)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:153)
at org.hibernate.cfg.Configuration.add(Configuration.java:424)
at org.hibernate.cfg.Configuration.addXML(Configuration.java:38 4)
at org.eclipse.emf.teneo.hibernate.HbDataStore.mapModel(HbDataS tore.java:364)
at org.eclipse.emf.teneo.hibernate.HbDataStore.initialize(HbDat aStore.java:156)
at org.ziptie.cisco.cs3800Load.doLoadDoc(cs3800Load.java:63)

There are two XSDs (one included by the other) with different namespaces, each with a type definition for InterfaceCard. The including XSD extends the type of the included namespace. When I look at the mapping, the entity-name fields are unique (they have the namespaces prefixed) and the descriminator fields are unique (again, the namespace is prefixed). In fact, everything is unique with the exception of the meta tag for "eclassName" - they are both InterfaceCard without any namespace prefixes.

I tried both the default and the "JOINED" Inheritance mapping strategies and both result in the same exception although the mappings are obviously a bit different. Here is the mapping for these types using the default inheritance strategy:

<subclass entity-name="types.InterfaceCard" abstract="false" lazy="false" extends="types.Card" discriminator-value="types.InterfaceCard">
<meta attribute="eclassName">InterfaceCard</meta>
<meta attribute="epackage">http://www.ziptie.org/1.0/zipTypes</meta>
<list name="port" lazy="true" cascade="all,delete-orphan">
<key update="true">
<column name="`interfacecard_port_id`" not-null="false" unique="false"/>
</key>
<list-index column="`interfacecard_port_idx`"/>
<one-to-many entity-name="types.Port"/>
</list>
</subclass>
<subclass entity-name="cisco3800.InterfaceCard" abstract="false" lazy="false" extends="types.InterfaceCard" discriminator-value="cisco3800.InterfaceCard">
<meta attribute="eclassName">InterfaceCard</meta>
<meta attribute="epackage">http://www.ziptie.org/cisco3800</meta>
<property name="icType" lazy="false" not-null="false" insert="true" update="true" unique="false">
<column not-null="false" unique="false" name="`ictype`"/>
<type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType" >
<param name="enumClass">org.ziptie.cisco3800.IcTypeType</param>
</type>
</property>
</subclass>

And here is the mapping for the JOINED strategy:

<joined-subclass entity-name="types.InterfaceCard" abstract="false" lazy="false" extends="types.Card" table="`interfacecard`">
<meta attribute="eclassName">InterfaceCard</meta>
<meta attribute="epackage">http://www.ziptie.org/1.0/zipTypes</meta>
<key>
<column name="`card_id`"/>
</key>
<list name="port" lazy="true" cascade="all,delete-orphan">
<key update="true">
<column name="`interfacecard_port_id`" not-null="false" unique="false"/>
</key>
<list-index column="`interfacecard_port_idx`"/>
<one-to-many entity-name="types.Port"/>
</list>
</joined-subclass>
<joined-subclass entity-name="cisco3800.InterfaceCard" abstract="false" lazy="false" extends="types.InterfaceCard" table="`interfacecard`">
<meta attribute="eclassName">InterfaceCard</meta>
<meta attribute="epackage">http://www.ziptie.org/cisco3800</meta>
<key>
<column name="`interfacecard_id`"/>
</key>
<property name="icType" lazy="false" not-null="false" insert="true" update="true" unique="false">
<column not-null="false" unique="false" name="`ictype`"/>
<type name="org.eclipse.emf.teneo.hibernate.mapping.ENumUserType" >
<param name="enumClass">org.ziptie.cisco3800.IcTypeType</param>
</type>
</property>
</joined-subclass>

Like the default inheritance strategy, the entity-names are unique and the meta attribute eclassName is not. However, note that the table names are the same. That is probably bad mojo.

Outside of hand editing the generated hbm file, is there some other way to fix or control this behavior?

Thanks,

Brian
Previous Topic:Generating EMF model with virtual attributes
Next Topic:[Teneo] Setting a 'unique' constraint on a many-to-one reference in hibernate
Goto Forum:
  


Current Time: Thu Apr 25 22:13:23 GMT 2024

Powered by FUDForum. Page generated in 0.02598 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top