Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Duplicate properties appearing in subclass.
Duplicate properties appearing in subclass. [message #76017] Tue, 20 March 2007 12:25 Go to next message
Duncan Alexander is currently offline Duncan AlexanderFriend
Messages: 90
Registered: July 2009
Member
Hi,
I am having an issue whereby a subclass in my Teneo generated hibernate mapping appears to be
duplicating the properties of a superclass. When attempting to initialise the database with the
mapping it throws an error :

Exception in thread "main" org.hibernate.MappingException: Repeated column in mapping for entity:
kf.CodedXSMeasure column: xsattachdataset (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:652)
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDup lication(PersistentClass.java:674)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:696)

The ecore generated from my model appears to be correct in that there is no duplication, it only
appears after generating the hibernate mapping. The classes are UncodedMeasure and CodedMeasure.
UncodedMeasure is generated correctly, but CodedMeasure is not.

My ecore looks like this:

<eClassifiers xsi:type="ecore:EClass" name="UncodedMeasure" eSuperTypes="#//Measure
base.ecore#//Codable"/>

<eClassifiers xsi:type="ecore:EClass" name="CodedMeasure" eSuperTypes="#//Measure
base.ecore#//Codable"/>

But my generated hibernate mapping comes out as:

<subclass entity-name="UncodedMeasure" abstract="false" lazy="false" extends="Measure"
discriminator-value="UncodedMeasure">
<meta attribute="eclassName">UncodedMeasure</meta>
<meta attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
</subclass>

<subclass entity-name="CodedMeasure" abstract="false" lazy="false" extends="Measure"
discriminator-value="CodedMeasure">
<meta attribute="eclassName">CodedMeasure</meta>
<meta attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
<property name="xsAttachDataset" lazy="false" insert="true" update="true" not-null="false"
unique="false" type="java.lang.Boolean">
<column not-null="false" unique="false" name="`xsattachdataset`"/>
</property>
<property name="xsAttachGroup" lazy="false" insert="true" update="true" not-null="false"
unique="false" type="java.lang.Boolean">
<column not-null="false" unique="false" name="`xsattachgroup`"/>
</property>
<property name="xsAttachSection" lazy="false" insert="true" update="true" not-null="false"
unique="false" type="java.lang.Boolean">
<column not-null="false" unique="false" name="`xsattachsection`"/>
</property>
<property name="xsAttachObservation" lazy="false" insert="true" update="true" not-null="false"
unique="false" type="java.lang.Boolean">
<column not-null="false" unique="false" name="`xsattachobservation`"/>
</property>
<property name="timeFormat" lazy="false" insert="true" update="true" not-null="false"
unique="false" type="java.lang.Boolean">
<column not-null="false" unique="false" name="`timeformat`"/>
</property>
<many-to-one name="CodeList" entity-name="ItemScheme"
cascade="merge,persist,save-update,lock,refresh" lazy="false" insert="true" update="true"
not-null="false">
<column not-null="false" unique="false" name="`itemscheme_codelist_urn`"/>
</many-to-one>
</subclass>


The properties which are mapped under CodedMeasure should not be there as they form part of a class
further up the heirarchy and there is nothing in the ecore to indicate that the two classes should
be mapped differently. They do normally have some other differentiating features but I have stripped
them out to highlight the problem.

regards

Duncan
Re: Duplicate properties appearing in subclass. [message #76049 is a reply to message #76017] Tue, 20 March 2007 12:39 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Duncan,
Can you send me the complete ecore?

gr. Martin

Duncan ALexander wrote:
> Hi,
> I am having an issue whereby a subclass in my Teneo generated
> hibernate mapping appears to be duplicating the properties of a
> superclass. When attempting to initialise the database with the mapping
> it throws an error :
>
> Exception in thread "main" org.hibernate.MappingException: Repeated
> column in mapping for entity: kf.CodedXSMeasure column: xsattachdataset
> (should be mapped with insert="false" update="false")
> at
> org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:652)
>
> at
> org.hibernate.mapping.PersistentClass.checkPropertyColumnDup lication(PersistentClass.java:674)
>
> at
> org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:696)
>
>
> The ecore generated from my model appears to be correct in that there is
> no duplication, it only appears after generating the hibernate mapping.
> The classes are UncodedMeasure and CodedMeasure. UncodedMeasure is
> generated correctly, but CodedMeasure is not.
>
> My ecore looks like this:
>
> <eClassifiers xsi:type="ecore:EClass" name="UncodedMeasure"
> eSuperTypes="#//Measure base.ecore#//Codable"/>
>
> <eClassifiers xsi:type="ecore:EClass" name="CodedMeasure"
> eSuperTypes="#//Measure base.ecore#//Codable"/>
>
> But my generated hibernate mapping comes out as:
>
> <subclass entity-name="UncodedMeasure" abstract="false" lazy="false"
> extends="Measure" discriminator-value="UncodedMeasure">
> <meta attribute="eclassName">UncodedMeasure</meta>
> <meta
> attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
>
> </subclass>
>
> <subclass entity-name="CodedMeasure" abstract="false" lazy="false"
> extends="Measure" discriminator-value="CodedMeasure">
> <meta attribute="eclassName">CodedMeasure</meta>
> <meta
> attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
>
> <property name="xsAttachDataset" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.Boolean">
> <column not-null="false" unique="false"
> name="`xsattachdataset`"/>
> </property>
> <property name="xsAttachGroup" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.Boolean">
> <column not-null="false" unique="false"
> name="`xsattachgroup`"/>
> </property>
> <property name="xsAttachSection" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.Boolean">
> <column not-null="false" unique="false"
> name="`xsattachsection`"/>
> </property>
> <property name="xsAttachObservation" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.Boolean">
> <column not-null="false" unique="false"
> name="`xsattachobservation`"/>
> </property>
> <property name="timeFormat" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.Boolean">
> <column not-null="false" unique="false" name="`timeformat`"/>
> </property>
> <many-to-one name="CodeList" entity-name="ItemScheme"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> insert="true" update="true" not-null="false">
> <column not-null="false" unique="false"
> name="`itemscheme_codelist_urn`"/>
> </many-to-one>
> </subclass>
>
>
> The properties which are mapped under CodedMeasure should not be there
> as they form part of a class further up the heirarchy and there is
> nothing in the ecore to indicate that the two classes should be mapped
> differently. They do normally have some other differentiating features
> but I have stripped them out to highlight the problem.
>
> regards
>
> Duncan


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Duplicate properties appearing in subclass. [message #76066 is a reply to message #76049] Tue, 20 March 2007 14:49 Go to previous messageGo to next message
Duncan Alexander is currently offline Duncan AlexanderFriend
Messages: 90
Registered: July 2009
Member
Martin et al,
in leiu of a fix for this should I be able to add annotations to change the attributes of these fields.

Is it possible to set the insert and update attributes of a mapped property through annotations ?

Thanks again

Duncan

Martin Taal wrote:
> Hi Duncan,
> Can you send me the complete ecore?
>
> gr. Martin
>
> Duncan ALexander wrote:
>> Hi,
>> I am having an issue whereby a subclass in my Teneo generated
>> hibernate mapping appears to be duplicating the properties of a
>> superclass. When attempting to initialise the database with the
>> mapping it throws an error :
>>
>> Exception in thread "main" org.hibernate.MappingException: Repeated
>> column in mapping for entity: kf.CodedXSMeasure column:
>> xsattachdataset (should be mapped with insert="false" update="false")
>> at
>> org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:652)
>>
>> at
>> org.hibernate.mapping.PersistentClass.checkPropertyColumnDup lication(PersistentClass.java:674)
>>
>> at
>> org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:696)
>>
>>
>> The ecore generated from my model appears to be correct in that there
>> is no duplication, it only appears after generating the hibernate
>> mapping. The classes are UncodedMeasure and CodedMeasure.
>> UncodedMeasure is generated correctly, but CodedMeasure is not.
>>
>> My ecore looks like this:
>>
>> <eClassifiers xsi:type="ecore:EClass" name="UncodedMeasure"
>> eSuperTypes="#//Measure base.ecore#//Codable"/>
>>
>> <eClassifiers xsi:type="ecore:EClass" name="CodedMeasure"
>> eSuperTypes="#//Measure base.ecore#//Codable"/>
>>
>> But my generated hibernate mapping comes out as:
>>
>> <subclass entity-name="UncodedMeasure" abstract="false" lazy="false"
>> extends="Measure" discriminator-value="UncodedMeasure">
>> <meta attribute="eclassName">UncodedMeasure</meta>
>> <meta
>> attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
>>
>> </subclass>
>> <subclass entity-name="CodedMeasure" abstract="false" lazy="false"
>> extends="Measure" discriminator-value="CodedMeasure">
>> <meta attribute="eclassName">CodedMeasure</meta>
>> <meta
>> attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
>>
>> <property name="xsAttachDataset" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>> <column not-null="false" unique="false"
>> name="`xsattachdataset`"/>
>> </property>
>> <property name="xsAttachGroup" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>> <column not-null="false" unique="false"
>> name="`xsattachgroup`"/>
>> </property>
>> <property name="xsAttachSection" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>> <column not-null="false" unique="false"
>> name="`xsattachsection`"/>
>> </property>
>> <property name="xsAttachObservation" lazy="false"
>> insert="true" update="true" not-null="false" unique="false"
>> type="java.lang.Boolean">
>> <column not-null="false" unique="false"
>> name="`xsattachobservation`"/>
>> </property>
>> <property name="timeFormat" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>> <column not-null="false" unique="false" name="`timeformat`"/>
>> </property>
>> <many-to-one name="CodeList" entity-name="ItemScheme"
>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>> insert="true" update="true" not-null="false">
>> <column not-null="false" unique="false"
>> name="`itemscheme_codelist_urn`"/>
>> </many-to-one>
>> </subclass>
>>
>>
>> The properties which are mapped under CodedMeasure should not be there
>> as they form part of a class further up the heirarchy and there is
>> nothing in the ecore to indicate that the two classes should be mapped
>> differently. They do normally have some other differentiating features
>> but I have stripped them out to highlight the problem.
>>
>> regards
>>
>> Duncan
>
>
Re: Duplicate properties appearing in subclass. [message #76082 is a reply to message #76066] Tue, 20 March 2007 14:55 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Duncan,
It is partially a bug in the multi-inheritance handling. I solved this and will check this in later
today probably.
However on other issue remains: the uncodedmeasure and codedmeasure should have the same properties
in the hbm file. The difference happens because when I read the ecore files (to generate the hbm)
the uncodedmeasure has only one supertype (measure) while the codedmeasure has two supertypes:
measure and codable.
The strange thing is that when I open the ecores in the standard emf ecore editor that
uncodedmeasure has two supertypes (measure and codable).

When you look at your generated code and debug at runtime can you see which supertypes the
UncodedMeasure has?

Which version of emf are you using? I am using emf 2.3.

gr. Martin

Duncan ALexander wrote:
> Martin et al,
> in leiu of a fix for this should I be able to add annotations to
> change the attributes of these fields.
>
> Is it possible to set the insert and update attributes of a mapped
> property through annotations ?
>
> Thanks again
>
> Duncan
>
> Martin Taal wrote:
>> Hi Duncan,
>> Can you send me the complete ecore?
>>
>> gr. Martin
>>
>> Duncan ALexander wrote:
>>> Hi,
>>> I am having an issue whereby a subclass in my Teneo generated
>>> hibernate mapping appears to be duplicating the properties of a
>>> superclass. When attempting to initialise the database with the
>>> mapping it throws an error :
>>>
>>> Exception in thread "main" org.hibernate.MappingException: Repeated
>>> column in mapping for entity: kf.CodedXSMeasure column:
>>> xsattachdataset (should be mapped with insert="false" update="false")
>>> at
>>> org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:652)
>>>
>>> at
>>> org.hibernate.mapping.PersistentClass.checkPropertyColumnDup lication(PersistentClass.java:674)
>>>
>>> at
>>> org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:696)
>>>
>>>
>>> The ecore generated from my model appears to be correct in that there
>>> is no duplication, it only appears after generating the hibernate
>>> mapping. The classes are UncodedMeasure and CodedMeasure.
>>> UncodedMeasure is generated correctly, but CodedMeasure is not.
>>>
>>> My ecore looks like this:
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="UncodedMeasure"
>>> eSuperTypes="#//Measure base.ecore#//Codable"/>
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="CodedMeasure"
>>> eSuperTypes="#//Measure base.ecore#//Codable"/>
>>>
>>> But my generated hibernate mapping comes out as:
>>>
>>> <subclass entity-name="UncodedMeasure" abstract="false" lazy="false"
>>> extends="Measure" discriminator-value="UncodedMeasure">
>>> <meta attribute="eclassName">UncodedMeasure</meta>
>>> <meta
>>> attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
>>>
>>> </subclass>
>>> <subclass entity-name="CodedMeasure" abstract="false"
>>> lazy="false" extends="Measure" discriminator-value="CodedMeasure">
>>> <meta attribute="eclassName">CodedMeasure</meta>
>>> <meta
>>> attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
>>>
>>> <property name="xsAttachDataset" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>>> <column not-null="false" unique="false"
>>> name="`xsattachdataset`"/>
>>> </property>
>>> <property name="xsAttachGroup" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>>> <column not-null="false" unique="false"
>>> name="`xsattachgroup`"/>
>>> </property>
>>> <property name="xsAttachSection" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>>> <column not-null="false" unique="false"
>>> name="`xsattachsection`"/>
>>> </property>
>>> <property name="xsAttachObservation" lazy="false"
>>> insert="true" update="true" not-null="false" unique="false"
>>> type="java.lang.Boolean">
>>> <column not-null="false" unique="false"
>>> name="`xsattachobservation`"/>
>>> </property>
>>> <property name="timeFormat" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>>> <column not-null="false" unique="false"
>>> name="`timeformat`"/>
>>> </property>
>>> <many-to-one name="CodeList" entity-name="ItemScheme"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>>> insert="true" update="true" not-null="false">
>>> <column not-null="false" unique="false"
>>> name="`itemscheme_codelist_urn`"/>
>>> </many-to-one>
>>> </subclass>
>>>
>>>
>>> The properties which are mapped under CodedMeasure should not be
>>> there as they form part of a class further up the heirarchy and there
>>> is nothing in the ecore to indicate that the two classes should be
>>> mapped differently. They do normally have some other differentiating
>>> features but I have stripped them out to highlight the problem.
>>>
>>> regards
>>>
>>> Duncan
>>
>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Duplicate properties appearing in subclass. [message #603736 is a reply to message #76017] Tue, 20 March 2007 12:39 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Duncan,
Can you send me the complete ecore?

gr. Martin

Duncan ALexander wrote:
> Hi,
> I am having an issue whereby a subclass in my Teneo generated
> hibernate mapping appears to be duplicating the properties of a
> superclass. When attempting to initialise the database with the mapping
> it throws an error :
>
> Exception in thread "main" org.hibernate.MappingException: Repeated
> column in mapping for entity: kf.CodedXSMeasure column: xsattachdataset
> (should be mapped with insert="false" update="false")
> at
> org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:652)
>
> at
> org.hibernate.mapping.PersistentClass.checkPropertyColumnDup lication(PersistentClass.java:674)
>
> at
> org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:696)
>
>
> The ecore generated from my model appears to be correct in that there is
> no duplication, it only appears after generating the hibernate mapping.
> The classes are UncodedMeasure and CodedMeasure. UncodedMeasure is
> generated correctly, but CodedMeasure is not.
>
> My ecore looks like this:
>
> <eClassifiers xsi:type="ecore:EClass" name="UncodedMeasure"
> eSuperTypes="#//Measure base.ecore#//Codable"/>
>
> <eClassifiers xsi:type="ecore:EClass" name="CodedMeasure"
> eSuperTypes="#//Measure base.ecore#//Codable"/>
>
> But my generated hibernate mapping comes out as:
>
> <subclass entity-name="UncodedMeasure" abstract="false" lazy="false"
> extends="Measure" discriminator-value="UncodedMeasure">
> <meta attribute="eclassName">UncodedMeasure</meta>
> <meta
> attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
>
> </subclass>
>
> <subclass entity-name="CodedMeasure" abstract="false" lazy="false"
> extends="Measure" discriminator-value="CodedMeasure">
> <meta attribute="eclassName">CodedMeasure</meta>
> <meta
> attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
>
> <property name="xsAttachDataset" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.Boolean">
> <column not-null="false" unique="false"
> name="`xsattachdataset`"/>
> </property>
> <property name="xsAttachGroup" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.Boolean">
> <column not-null="false" unique="false"
> name="`xsattachgroup`"/>
> </property>
> <property name="xsAttachSection" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.Boolean">
> <column not-null="false" unique="false"
> name="`xsattachsection`"/>
> </property>
> <property name="xsAttachObservation" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.Boolean">
> <column not-null="false" unique="false"
> name="`xsattachobservation`"/>
> </property>
> <property name="timeFormat" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.Boolean">
> <column not-null="false" unique="false" name="`timeformat`"/>
> </property>
> <many-to-one name="CodeList" entity-name="ItemScheme"
> cascade="merge,persist,save-update,lock,refresh" lazy="false"
> insert="true" update="true" not-null="false">
> <column not-null="false" unique="false"
> name="`itemscheme_codelist_urn`"/>
> </many-to-one>
> </subclass>
>
>
> The properties which are mapped under CodedMeasure should not be there
> as they form part of a class further up the heirarchy and there is
> nothing in the ecore to indicate that the two classes should be mapped
> differently. They do normally have some other differentiating features
> but I have stripped them out to highlight the problem.
>
> regards
>
> Duncan


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Duplicate properties appearing in subclass. [message #603740 is a reply to message #76049] Tue, 20 March 2007 14:49 Go to previous message
Duncan Alexander is currently offline Duncan AlexanderFriend
Messages: 90
Registered: July 2009
Member
Martin et al,
in leiu of a fix for this should I be able to add annotations to change the attributes of these fields.

Is it possible to set the insert and update attributes of a mapped property through annotations ?

Thanks again

Duncan

Martin Taal wrote:
> Hi Duncan,
> Can you send me the complete ecore?
>
> gr. Martin
>
> Duncan ALexander wrote:
>> Hi,
>> I am having an issue whereby a subclass in my Teneo generated
>> hibernate mapping appears to be duplicating the properties of a
>> superclass. When attempting to initialise the database with the
>> mapping it throws an error :
>>
>> Exception in thread "main" org.hibernate.MappingException: Repeated
>> column in mapping for entity: kf.CodedXSMeasure column:
>> xsattachdataset (should be mapped with insert="false" update="false")
>> at
>> org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:652)
>>
>> at
>> org.hibernate.mapping.PersistentClass.checkPropertyColumnDup lication(PersistentClass.java:674)
>>
>> at
>> org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:696)
>>
>>
>> The ecore generated from my model appears to be correct in that there
>> is no duplication, it only appears after generating the hibernate
>> mapping. The classes are UncodedMeasure and CodedMeasure.
>> UncodedMeasure is generated correctly, but CodedMeasure is not.
>>
>> My ecore looks like this:
>>
>> <eClassifiers xsi:type="ecore:EClass" name="UncodedMeasure"
>> eSuperTypes="#//Measure base.ecore#//Codable"/>
>>
>> <eClassifiers xsi:type="ecore:EClass" name="CodedMeasure"
>> eSuperTypes="#//Measure base.ecore#//Codable"/>
>>
>> But my generated hibernate mapping comes out as:
>>
>> <subclass entity-name="UncodedMeasure" abstract="false" lazy="false"
>> extends="Measure" discriminator-value="UncodedMeasure">
>> <meta attribute="eclassName">UncodedMeasure</meta>
>> <meta
>> attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
>>
>> </subclass>
>> <subclass entity-name="CodedMeasure" abstract="false" lazy="false"
>> extends="Measure" discriminator-value="CodedMeasure">
>> <meta attribute="eclassName">CodedMeasure</meta>
>> <meta
>> attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
>>
>> <property name="xsAttachDataset" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>> <column not-null="false" unique="false"
>> name="`xsattachdataset`"/>
>> </property>
>> <property name="xsAttachGroup" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>> <column not-null="false" unique="false"
>> name="`xsattachgroup`"/>
>> </property>
>> <property name="xsAttachSection" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>> <column not-null="false" unique="false"
>> name="`xsattachsection`"/>
>> </property>
>> <property name="xsAttachObservation" lazy="false"
>> insert="true" update="true" not-null="false" unique="false"
>> type="java.lang.Boolean">
>> <column not-null="false" unique="false"
>> name="`xsattachobservation`"/>
>> </property>
>> <property name="timeFormat" lazy="false" insert="true"
>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>> <column not-null="false" unique="false" name="`timeformat`"/>
>> </property>
>> <many-to-one name="CodeList" entity-name="ItemScheme"
>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>> insert="true" update="true" not-null="false">
>> <column not-null="false" unique="false"
>> name="`itemscheme_codelist_urn`"/>
>> </many-to-one>
>> </subclass>
>>
>>
>> The properties which are mapped under CodedMeasure should not be there
>> as they form part of a class further up the heirarchy and there is
>> nothing in the ecore to indicate that the two classes should be mapped
>> differently. They do normally have some other differentiating features
>> but I have stripped them out to highlight the problem.
>>
>> regards
>>
>> Duncan
>
>
Re: Duplicate properties appearing in subclass. [message #603744 is a reply to message #76066] Tue, 20 March 2007 14:55 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Duncan,
It is partially a bug in the multi-inheritance handling. I solved this and will check this in later
today probably.
However on other issue remains: the uncodedmeasure and codedmeasure should have the same properties
in the hbm file. The difference happens because when I read the ecore files (to generate the hbm)
the uncodedmeasure has only one supertype (measure) while the codedmeasure has two supertypes:
measure and codable.
The strange thing is that when I open the ecores in the standard emf ecore editor that
uncodedmeasure has two supertypes (measure and codable).

When you look at your generated code and debug at runtime can you see which supertypes the
UncodedMeasure has?

Which version of emf are you using? I am using emf 2.3.

gr. Martin

Duncan ALexander wrote:
> Martin et al,
> in leiu of a fix for this should I be able to add annotations to
> change the attributes of these fields.
>
> Is it possible to set the insert and update attributes of a mapped
> property through annotations ?
>
> Thanks again
>
> Duncan
>
> Martin Taal wrote:
>> Hi Duncan,
>> Can you send me the complete ecore?
>>
>> gr. Martin
>>
>> Duncan ALexander wrote:
>>> Hi,
>>> I am having an issue whereby a subclass in my Teneo generated
>>> hibernate mapping appears to be duplicating the properties of a
>>> superclass. When attempting to initialise the database with the
>>> mapping it throws an error :
>>>
>>> Exception in thread "main" org.hibernate.MappingException: Repeated
>>> column in mapping for entity: kf.CodedXSMeasure column:
>>> xsattachdataset (should be mapped with insert="false" update="false")
>>> at
>>> org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:652)
>>>
>>> at
>>> org.hibernate.mapping.PersistentClass.checkPropertyColumnDup lication(PersistentClass.java:674)
>>>
>>> at
>>> org.hibernate.mapping.PersistentClass.checkColumnDuplication (PersistentClass.java:696)
>>>
>>>
>>> The ecore generated from my model appears to be correct in that there
>>> is no duplication, it only appears after generating the hibernate
>>> mapping. The classes are UncodedMeasure and CodedMeasure.
>>> UncodedMeasure is generated correctly, but CodedMeasure is not.
>>>
>>> My ecore looks like this:
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="UncodedMeasure"
>>> eSuperTypes="#//Measure base.ecore#//Codable"/>
>>>
>>> <eClassifiers xsi:type="ecore:EClass" name="CodedMeasure"
>>> eSuperTypes="#//Measure base.ecore#//Codable"/>
>>>
>>> But my generated hibernate mapping comes out as:
>>>
>>> <subclass entity-name="UncodedMeasure" abstract="false" lazy="false"
>>> extends="Measure" discriminator-value="UncodedMeasure">
>>> <meta attribute="eclassName">UncodedMeasure</meta>
>>> <meta
>>> attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
>>>
>>> </subclass>
>>> <subclass entity-name="CodedMeasure" abstract="false"
>>> lazy="false" extends="Measure" discriminator-value="CodedMeasure">
>>> <meta attribute="eclassName">CodedMeasure</meta>
>>> <meta
>>> attribute="epackage">http://www.sdmx.org/resources/infomodel/1.0/keyfamily.xmi</meta>
>>>
>>> <property name="xsAttachDataset" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>>> <column not-null="false" unique="false"
>>> name="`xsattachdataset`"/>
>>> </property>
>>> <property name="xsAttachGroup" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>>> <column not-null="false" unique="false"
>>> name="`xsattachgroup`"/>
>>> </property>
>>> <property name="xsAttachSection" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>>> <column not-null="false" unique="false"
>>> name="`xsattachsection`"/>
>>> </property>
>>> <property name="xsAttachObservation" lazy="false"
>>> insert="true" update="true" not-null="false" unique="false"
>>> type="java.lang.Boolean">
>>> <column not-null="false" unique="false"
>>> name="`xsattachobservation`"/>
>>> </property>
>>> <property name="timeFormat" lazy="false" insert="true"
>>> update="true" not-null="false" unique="false" type="java.lang.Boolean">
>>> <column not-null="false" unique="false"
>>> name="`timeformat`"/>
>>> </property>
>>> <many-to-one name="CodeList" entity-name="ItemScheme"
>>> cascade="merge,persist,save-update,lock,refresh" lazy="false"
>>> insert="true" update="true" not-null="false">
>>> <column not-null="false" unique="false"
>>> name="`itemscheme_codelist_urn`"/>
>>> </many-to-one>
>>> </subclass>
>>>
>>>
>>> The properties which are mapped under CodedMeasure should not be
>>> there as they form part of a class further up the heirarchy and there
>>> is nothing in the ecore to indicate that the two classes should be
>>> mapped differently. They do normally have some other differentiating
>>> features but I have stripped them out to highlight the problem.
>>>
>>> regards
>>>
>>> Duncan
>>
>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:Duplicate properties appearing in subclass.
Next Topic:[Teneo]Multiple inheritance with multi-valued EReferences in second inherited class fails
Goto Forum:
  


Current Time: Sat Oct 31 05:26:50 GMT 2020

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

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

Back to the top