[
https://issues.apache.org/jira/browse/TORQUE-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17905085#comment-17905085
]
Max Philipp Wriedt edited comment on TORQUE-369 at 12/12/24 9:39 AM:
-
I must admit that I am not nearly as far into the generation process in general
as I would like to be, but I think the foreign key checks are disabled by
default in every torque-generated sql file.
As for my specific usecase: i want to split up certain table groups into the
following 3 schemata:
* General Tables (e.g. table "gender)
* Account/User/whatever specific tables (e.g. table account)
* Item-specific tables (e.g. table items)
The item and account/user tables reference the general tables (for e.g.
different genders) as external schema.
The items table may need a account reference, so we reference the account
schema in items and maybe an account table needs a table from the item schema.
Now we have item with reference to account and vice-versa. The Generator at
this time is not aware, that the schema for account is already read into the
graph.
The controller responsible for generation is inside torque-generator and knows
its origin (getSource of "ControllerState"). The IncludeSchemaTransformer and
LoadExternalSchemaTransformer on the other hand are part of torque-templates.
Although they also get the ControllerState, they are not aware of which Files
they already stepped through.
My approach is to add a HashSet/List of File to the ControllerState where a
file is added, when one of the transformers processes that file.
was (Author: JIRAUSER299058):
I must admit that I am not nearly as far into the generation process in general
as I would like to be, but I think the foreign key checks are disabled by
default in every torque-generated sql file.
As for my specific usecase: i want to split up certain table groups into the
following 3 schemata:
* General Tables (e.g. table "gender)
* Account/User/whatever specific tables (e.g. table account)
* Item-specific tables (e.g. table items)
The item and account/user tables reference the general tables (for e.g.
different genders) as external schema.
The items table may need a account reference, so we reference the account
schema in items and maybe an account table needs a table from the item schema.
Now we have item with reference to account and vice-versa. The Generator at
this time is not aware, that the schema for account is already read into the
graph.
The controller responsible for generation is inside torque-generator and now
its origin (getSource of "ControllerState"). The IncludeSchemaTransformer and
LoadExternalSchemaTransformer on the other hand are part of torque-templates.
Although they also get the ControllerState, they are not aware of which Files
they already stepped through.
My approach is to add a HashSet/List of File to the ControllerState where a
file is added, when one of the transformers processes that file.
> LoadExternalSchemaTransformer recursively includes when cross-referencing
> -
>
> Key: TORQUE-369
> URL: https://issues.apache.org/jira/browse/TORQUE-369
> Project: Torque
> Issue Type: Bug
> Components: Templates
>Affects Versions: 5.1, 6.0
>Reporter: Max Philipp Wriedt
>Assignee: Max Philipp Wriedt
>Priority: Major
>
> When referencing an external schema (to use foreign key references in another
> schema definition) and back referencing to its origin, we get an infinite
> recursion.
> Affects:
> org.apache.torque.templates.transformer.LoadExternalSchemaTransformer.transform()
> Example:
> First Schema:
> {code:java}
>
>
>
>
> primaryKey="true"/>
> size="5"/>
> type="INTEGER" size="2"/>
>
>
> {code}
> Second Schema:
> {code:java}
>
> xmlns="http://db.apache.org/torque/5.0/templates/database";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://db.apache.org/torque/5.0/templates/database
>
> https://db.apache.org/torque/torque-5.0/documentation/orm-reference/database-5-0-strict.xsd";
> name="test" defaultIdMethod="native" defaultJavaType="object">
>
>
> primaryKey="true"/>
> size="5"/>
>
>
> primaryKey="true"/>
> size="5"/>
> type="INTEGER" size="2"/>
>
>
> {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]