[jira] [Updated] (TORQUE-374) Generated code build failure: multiple foreign keys the same table

"Max Philipp Wriedt (Jira)" <[email protected]> Wed, 17 Jun 2026 13:18:00 +0000 (UTC)
Newsgroups gmane.comp.jakarta.turbine.torque.devel
Message-ID <[email protected]>
     [ https://issues.apache.org/jira/browse/TORQUE-374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Max Philipp Wriedt updated TORQUE-374:
--------------------------------------
    Attachment: torque-374-objectIsCaching.patch

> 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
>            Priority: Major
>         Attachments: build-torque.xml, generated-sources.zip, generated-sql.zip, torque-374-objectIsCaching.patch, torque-test.zip
>
>
> 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)