AttributeOverride of Parent's Component [message #619213] |
Fri, 06 June 2008 23:50 |
Alex Black Messages: 15 Registered: July 2009 |
Junior Member |
|
|
Hello,
A co-worked of mine has the following situation:
He has a base class (LensBase) with a Component (DatePeriod). He then
derives from this base class (Lens) and wants to use AttributeOverride the
database mapping for the parent class's component. That is, Lens wants to
over-ride the database mapping for LensBase.effectiveDatePeriod:
<xsd:complexType name="DatePeriod">
<xsd:annotation><xsd:appinfo source="teneo.jpa">@MappedSuperclass
@Embeddable</xsd:appinfo></xsd:annotation>
<xsd:sequence>
</xsd:sequence>
<!-- Primitive Data Fields -->
<xsd:attribute name="start" type="xsd:date" use="required" />
<xsd:attribute name="end" type="xsd:date" use="required" />
</xsd:complexType>
<xsd:complexType name="LensBase">
<xsd:annotation>
<xsd:appinfo source="teneo.jpa">
@MappedSuperclass
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="effectiveDatePeriod"
type="DatePeriod" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="teneo.jpa">
@Embedded
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Lens">
<xsd:annotation>
<xsd:appinfo source="teneo.jpa">
@Entity
@Table( name="CSA4521T" )
@AttributeOverrides({
@AttributeOverride(name="effectiveDatePeriod.start", column =
@Column(name="PRODUCT_EFF_DT")),
@AttributeOverride(name="effectiveDatePeriod.end", column =
@Column(name="PRODUCT_TERM_DT")),
@AttributeOverride(name="displayOrder", column =
@Column(name="DISPLAY_SORT_NBR")) })
</xsd:appinfo>
<xsd:documentation>
Lens Style Information
</xsd:documentation>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="LensBase">
<xsd:sequence>
...
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
This doesn't work, it errors out with the name of the default hibernate
generated columns instead of the mapped ones.
Any ideas? Are we on the right track here?
Thanks!
-Alex
|
|
|
Powered by
FUDForum. Page generated in 0.03334 seconds