Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] Difficulty extending embeddable types
[Teneo] Difficulty extending embeddable types [message #118703] Wed, 16 April 2008 19:57
Alex Black is currently offline Alex BlackFriend
Messages: 15
Registered: July 2009
Junior Member
Hello,
I'm having difficulty getting an extended embeddable type to map correctly.
I have an embeddable type, Address:


------------------------------------------------------------ ---------------------
<xsd:complexType name="Address">
<xsd:annotation>
<xsd:appinfo source="teneo.jpa">@Embeddable</xsd:appinfo>
</xsd:annotation>

<xsd:sequence>

<xsd:element default="" name="street1" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Address Street line 1
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element default="" name="street2" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Address Street line 2
</xsd:documentation>
</xsd:annotation>
</xsd:element>

.............................more elements................

</xsd:sequence>
</xsd:complexType>


------------------------------------------------------------ ---------------------


I then have a derived embeddable type, GeocodedAddress:

------------------------------------------------------------ ---------------------

<xsd:include schemaLocation="Address.xsd"/>
<xsd:complexType name="GeocodedAddress">

<xsd:annotation>
<xsd:appinfo source="teneo.jpa">@Embeddable</xsd:appinfo>
</xsd:annotation>


<xsd:complexContent>
<xsd:extension base="contact:Address">
<xsd:sequence>

<xsd:element name="longitude" type="xsd:double"/>
<xsd:element name="latitude" type="xsd:double"/>

</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
------------------------------------------------------------ ---------------------

I then try to embed the GeocodedAddress in another complex type:

------------------------------------------------------------ ---------------------
<xsd:element name="physicalAddress" type="contact:GeocodedAddress">
<xsd:annotation>
<xsd:appinfo source="teneo.jpa">
@Embedded
@AttributeOverrides({
@AttributeOverride(name="street1",
column=@Column(name="PHYSLN1_ADR")),
@AttributeOverride(name="street2",
column=@Column(name="PHYSLN2_ADR")),

.........more columns..........................

@AttributeOverride(name="longitude",
column=@Column(name="LONGITUDE")),
@AttributeOverride(name="latitude", column=@Column(name="LATITUDE"))
})
</xsd:appinfo>
</xsd:annotation>
</xsd:element>



------------------------------------------------------------ ---------------------

When I try to read the object containing the physicalAddress property from
the database, it only serializes the GeocodedAddress information (latitude
and longitude), not the Address information (street1, 2, and others). The
Java classes appear to generate fine, with inheritence intact. I looked at
the generated hibernate mapping and it appears to simply not map the Address
fields:

------------------------------------------------------------ ---------------------


<component name="physicalAddress" class="contact.impl.GeocodedAddressImpl">
<property name="longitude" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="double">
<column not-null="false" unique="false" name="longitude"/>
</property>
<property name="latitude" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="double">
<column not-null="false" unique="false" name="latitude"/>
</property>
</component>

------------------------------------------------------------ ---------------------

In the code excerpts above I've simplified the package structure slightly,
but no other changes were made. The Address class works fine on its own and
worked fine as a "PhysicalAddress" before I added the GeocodedAddress
extension. Am I configuring this correctly and approaching this problem in
an appropriate way?

Thanks for all the help and the great project!

-Alex
Previous Topic:[TENEO] Containment References in Lagacy DB
Next Topic:[Teneo] Difficulty extending embeddable types
Goto Forum:
  


Current Time: Sat Apr 04 16:36:22 GMT 2020

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

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

Back to the top