[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| 
Re: [eclipselink-users] inheritance with TABLE_PER_CLASS
 | 
Hi Markus,
  Table per class inheritance is available as an optional feature in the 
specification.
  EclipseLink provides some basic support based on what is described in the 
specification.
  The following wiki page is from our design cycle and points out some current 
limitations:
http://wiki.eclipse.org/EclipseLink/Development/JPA_1.0/table_per_class
  Are you having specific issues?  If so, this list is a good place to discuss 
them.  Also, if you are encountering bugs related to the limitations, please 
have a look through bugzilla and vote for any bugs that are issues for you, or 
file your own.
-Tom
Hahn, Markus wrote:
Hi,
i want to use inheritance for a hierarchy where the base class contains 
ALL attributes and the 2 subclasses none. But the subclasses are mapped 
to different database tables.
I know that polymorphic associations are not possible in JPA 1.0 but are 
there ways to capture this scenario in EL?
Below an xml snippet:
Base class:
  <orm:entity class="ChangeTrackingExportEntryBase">
      <orm:inheritance strategy="TABLE_PER_CLASS"/>
      <orm:attributes>
      <orm:id name="id">
        <orm:column column-definition="decimal" length="18" name="ID"/>
        <orm:generated-value generator="SeqChangeTrackingExportEntry"/>
      </orm:id>
      <orm:basic name="attributeName">
        <orm:column length="128" name="ATTRIBUTENAME" nullable="true"/>
      </orm:basic>
      <orm:basic name="domainObjectName">
        <orm:column length="1000" name="DOMAINOBJECTNAME" nullable="true"/>
      </orm:basic>
      <orm:basic name="acknowledged">
        <orm:column name="ACKNOWLEDGEDATE" nullable="true"/>
      </orm:basic>
      <orm:basic name="exported">
        <orm:column name="EXPORTDATE" nullable="true"/>
      </orm:basic>
      <orm:basic name="created">
        <orm:column name="TSCREATE" nullable="false"/>
      </orm:basic>
      <orm:basic name="objectId">
        <orm:column column-definition="decimal" length="10" 
name="DOMAINOBJECTENTRYID" nullable="false"/>
      </orm:basic>
      <orm:version name="versionTimestamp">
        <orm:column name="TSUPDATE" nullable="false"/>
      </orm:version>
      <orm:many-to-one name="company" fetch="LAZY">
        <orm:join-column column-definition="decimal" length="18" 
name="ID_COMPANY" nullable="true"/>
        <orm:cascade>
          <orm:cascade-merge/>
        </orm:cascade>
      </orm:many-to-one>
      <orm:many-to-one name="changeExportRegistration" fetch="LAZY">
        <orm:join-column column-definition="decimal" length="18" 
name="ID_CHANGEEXPORTREGISTRATION" nullable="false"/>
        <orm:cascade>
          <orm:cascade-persist/>
          <orm:cascade-merge/>
        </orm:cascade>
      </orm:many-to-one>
      <orm:many-to-many name="changeTrackingLogEntries" 
mapped-by="changeTrackingExportEntries">
        <orm:cascade>
          <orm:cascade-persist/>
          <orm:cascade-merge/>
        </orm:cascade>
      </orm:many-to-many>
      <orm:many-to-one name="confirmedState" fetch="LAZY">
        <orm:join-column column-definition="decimal" 
name="ID_CONFIRMEDSTATE" nullable="true"/>
        <orm:cascade>
          <orm:cascade-merge/>
        </orm:cascade>
      </orm:many-to-one>
    </orm:attributes>
  </orm:entity>
The subclasses:
  <orm:entity class="ChangeTrackingExportEntry">
    <orm:table name="BUYING.CHANGETRACKINGEXPORTENTRY"/>
  </orm:entity>
  <orm:entity class="ChangeTrackingExportEntryHistory">
    <orm:table name="BUYING.CHANGETRACKINGEEHIST"/>
  </orm:entity>
Regards, Markus
------------------------------------------------------------------------
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users