openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bruceg <bruceg...@yahoo.com>
Subject issue with reading "link" tables
Date Tue, 28 Jul 2009 20:05:46 GMT

I have the following table structure:

Combination { id, name }
Combination_Element { id, combinationId, elementId }
Element { id, name }

When I read Combination_Element for some odd reason it returns 3 instances
of Element named "E1" where I have records named "E1", "E2" and "E3". The
count is correct but the names are not. I have only noticed this behavior
for this type (so far)! Note that Element has a mapped super class which
supplies the property with the issue so perhaps thats interesting.

The following are excerpts from my orm.xml file:

  <entity class="Combination">
    <table name="COMBINATION">
      <unique-constraint>
        <column-name>PAGE_ID</column-name>
        <column-name>NAME</column-name>
      </unique-constraint>
    </table>    
    <primary-key-join-column name="ID"/>
    <attributes>
      <basic name="kind">
        <column name="KIND" length="30" nullable="false"/>
      </basic>
      <many-to-one name="page" fetch="LAZY">
        <join-column name="PAGE_ID" referenced-column-name="ID"/>
      </many-to-one>
      <one-to-many name="elements" target-entity="CombinationElement"
mapped-by="combination">
        <cascade>
          <cascade-all/>
        </cascade>
      </one-to-many>
      <one-to-many name="layouts" target-entity="CombinationLayout"
mapped-by="combination">
        <cascade>
          <cascade-all/>
        </cascade>
      </one-to-many>
    </attributes>
  </entity>


  <entity class="CombinationElement">
    <table name="COMBINATION_ELEMENT">
      <unique-constraint>
        <column-name>COMBINATION_ID</column-name>
        <column-name>ELEMENT_ID</column-name>
      </unique-constraint>
    </table>
    <primary-key-join-column name="ID"/>
    <attributes>
      <many-to-one name="combination">
        <join-column name="COMBINATION_ID" referenced-column-name="ID"/>
      </many-to-one>
      <many-to-one name="element">
        <join-column name="ELEMENT_ID" referenced-column-name="ID"/>
      </many-to-one>
      <one-to-many name="alternates" target-entity="CombinationAlternate"
mapped-by="combinationElement">
        <cascade>
          <cascade-all/>
        </cascade>
      </one-to-many>
    </attributes>
  </entity>


  <entity class="Element">
    <table name="ELEMENT">
      <unique-constraint>
        <column-name>PAGE_ID</column-name>
        <column-name>NAME</column-name>
      </unique-constraint>
      <unique-constraint>
        <column-name>EXTERNAL</column-name>
      </unique-constraint>
    </table>    
    <primary-key-join-column name="ID"/>
    <attributes>
      <basic name="description">
        <column name="DESCRIPTION" length="1024"/>
      </basic>
      <basic name="external">
        <column name="EXTERNAL" length="100"/>
      </basic>
      <many-to-one name="page" fetch="LAZY">
        <join-column name="PAGE_ID" referenced-column-name="ID"/>
      </many-to-one>
      <one-to-many name="alternates" target-entity="Alternate"
mapped-by="element">
        <cascade>
          <cascade-all/>
        </cascade>
      </one-to-many>
      <one-to-many name="criterias" target-entity="ElementCriteria"
mapped-by="element">
        <cascade>
          <cascade-all/>
        </cascade>
      </one-to-many>
      <one-to-many name="pageGoals" target-entity="ElementPageGoal"
mapped-by="element">
        <cascade>
          <cascade-all/>
        </cascade>
      </one-to-many>
      <one-to-many name="properties" target-entity="ElementProperty"
mapped-by="element">
        <cascade>
          <cascade-all/>
        </cascade>
      </one-to-many>
    </attributes>
  </entity>


  <mapped-superclass class="AbstractNamed">
    <attributes>
      <basic name="name">
        <column name="NAME" length="100" nullable="false"/>
      </basic>
    </attributes>
  </mapped-superclass>
  <mapped-superclass class="AbtractProperty">
    <attributes>
      <basic name="name">
        <column name="NAME" length="100" nullable="false"/>
      </basic>
      <basic name="type">
        <column name="TYPE" length="200" nullable="false"/>
      </basic>
      <basic name="value">
        <column name="VALUE" length="1024" nullable="false"/>
      </basic>
    </attributes>
  </mapped-superclass>
-- 
View this message in context: http://n2.nabble.com/issue-with-reading-%22link%22-tables-tp3345667p3345667.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.

Mime
View raw message