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

"Georg Kallidis (Jira)" <[email protected]> Wed, 17 Jun 2026 14:29: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=
9675#comment-18089675 ]=20

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

ok, that was true. Although I could still not reproduce the error, when I c=
hange the default objectIsCaching to false and I could state, that the resu=
lting java code is different.

Nevertheless the patch seems to be very reasonable. When applying it to the=
 test, it generates all without errors using=C2=A0
{code:java}
ant generate -f build-torque.xml{code}
From all the Torque options in build.properties, which I used in the build =
task generate options only
{code:java}
torque.generateFiller =3D true {code}
is not the default false value for the option torque.om.complexObjectModel.=
generateFillers (which does not change the result for my test).

=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-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=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)