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

"Georg Kallidis (Jira)" <[email protected]> Tue, 16 Jun 2026 15:40:00 +0000 (UTC)
Newsgroups gmane.comp.jakarta.turbine.torque.devel
Message-ID <[email protected]>
    [ https://issues.apache.org/jira/browse/TORQUE-374?page=3Dcom.atlassian=
.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1808=
9406#comment-18089406 ]=20

Georg Kallidis commented on TORQUE-374:
---------------------------------------

I cannot confirm, though I got the schema generated, I might have missed th=
ings, usually not working with postgresql.

I attached my [^build-torque.xml] and the [^generated-sources.zip] and [^ge=
nerated-sql.zip]. I tested with Torque 7.0 and latest 7.1-SNAPSHOT.

=C2=A0

> 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-s=
ql.zip, 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=3D"thing_related"
>          description=3D"The table where all the policy premium relationsh=
ips are tracked">
>     <column
>       name=3D"thing_related_id"
>       required=3D"true"
>       primaryKey=3D"true"
>       type=3D"INTEGER"
>       description=3D"Thing related id"/>
>     <column
>       name=3D"original_id"
>       required=3D"true"
>       type=3D"INTEGER"
>       description=3D"Original thing"/>
>     <column
>       name=3D"related_id"
>       required=3D"true"
>       type=3D"INTEGER"
>       description=3D"Related thing"/>
>     <foreign-key foreignTable=3D"thing" onUpdate=3D"cascade" onDelete=3D"=
cascade">
>       <reference
>         local=3D"original_id"
>         foreign=3D"thing_id"/>
>     </foreign-key>
>     <foreign-key foreignTable=3D"thing" onUpdate=3D"cascade" onDelete=3D"=
cascade">
>       <reference
>         local=3D"related_id"
>         foreign=3D"thing_id"/>
>     </foreign-key>
>   </table>
> {code}
> Fails like this:
> {code}
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-pl=
ugin:3.14.0:compile (default-compile) on project torque-test: Compilation f=
ailure: Compilation failure:=20
> [ERROR] /Users/minfrin/src/fma/torque-test/target/generated-sources/org/a=
pache/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/a=
pache/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/a=
pache/torque/test/database/om/BaseThingPeerImpl.java:[593,17] cannot find s=
ymbol
> [ERROR]   symbol:   method resetThingReversalRelatedByOriginalId()
> [ERROR]   location: variable toLinkTo of type org.apache.torque.test.data=
base.om.Thing
> [ERROR] /Users/minfrin/src/fma/torque-test/target/generated-sources/org/a=
pache/torque/test/database/om/BaseThingPeerImpl.java:[629,21] cannot find s=
ymbol
> [ERROR]   symbol:   method isThingReversalRelatedByOriginalIdsInitialized=
()
> [ERROR]   location: variable toLinkTo of type org.apache.torque.test.data=
base.om.Thing
> [snip]
> {code}



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