Graham Leggett created TORQUE-374:
-------------------------------------

             Summary: Generated code build failure: multiple foreign keys the 
same table
                 Key: TORQUE-374
                 URL: https://issues.apache.org/jira/browse/TORQUE-374
             Project: Torque
          Issue Type: Bug
          Components: Templates
    Affects Versions: 7.0
            Reporter: Graham Leggett


When you have a table with this structure, torque7 creates code that does not 
compile. Torque3.3 works fine.

{code}
  <table name="thing_related"
         description="The table where all the policy premium relationships are 
tracked">
    <column
      name="thing_related_id"
      required="true"
      primaryKey="true"
      type="INTEGER"
      description="Thing related id"/>
    <column
      name="original_id"
      required="true"
      type="INTEGER"
      description="Original thing"/>
    <column
      name="related_id"
      required="true"
      type="INTEGER"
      description="Related thing"/>
    <foreign-key foreignTable="thing" onUpdate="cascade" onDelete="cascade">
      <reference
        local="original_id"
        foreign="thing_id"/>
    </foreign-key>
    <foreign-key foreignTable="thing" onUpdate="cascade" onDelete="cascade">
      <reference
        local="related_id"
        foreign="thing_id"/>
    </foreign-key>
  </table>
{code}

Fails like this:

{code}
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.14.0:compile (default-compile) 
on project torque-test: Compilation failure: Compilation failure: 
[ERROR] 
/Users/minfrin/src/fma/torque-test/target/generated-sources/org/apache/torque/test/database/om/BaseThing.java:[554,13]
 cannot find symbol
[ERROR]   symbol:   variable collThingReversalsRelatedByOriginalId
[ERROR]   location: class org.apache.torque.test.database.om.BaseThing
[ERROR] 
/Users/minfrin/src/fma/torque-test/target/generated-sources/org/apache/torque/test/database/om/BaseThing.java:[558,17]
 cannot find symbol
[ERROR]   symbol:   method initThingReversalRelatedByOriginalIds()
[ERROR]   location: class org.apache.torque.test.database.om.BaseThing
[snip]
[ERROR] 
/Users/minfrin/src/fma/torque-test/target/generated-sources/org/apache/torque/test/database/om/BaseThingPeerImpl.java:[593,17]
 cannot find symbol
[ERROR]   symbol:   method resetThingReversalRelatedByOriginalId()
[ERROR]   location: variable toLinkTo of type 
org.apache.torque.test.database.om.Thing
[ERROR] 
/Users/minfrin/src/fma/torque-test/target/generated-sources/org/apache/torque/test/database/om/BaseThingPeerImpl.java:[629,21]
 cannot find symbol
[ERROR]   symbol:   method isThingReversalRelatedByOriginalIdsInitialized()
[ERROR]   location: variable toLinkTo of type 
org.apache.torque.test.database.om.Thing
[snip]
{code}




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to