Quantcast

foreign keys, complexDataModel, and external schemas

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

foreign keys, complexDataModel, and external schemas

Helge Weissig
Hi,

        I just ran into what may be a feature or a bug... trying to find out which: When I define a table in schema1.xml and another two, including a  link table for a many-to-many relationship in schema2.xml, where schema2.xml includes schema1.xml as an external schema, torque will not generated the getter methods for the foreign keys.

To illustrate, I have created a github project. As you will see, there are two schema files: first-schema.xml and second-schema.xml which includes the first. The generated base classes for tbl1 and tbl3 differ in that BaseTbl3 has the getter methods for the link table tbl_link_int (e.g. getTblLinkInts()), whereas BaseTbl1 does not.

I think it would be a very useful feature to be able to split a large schema into several sub-schema files and not lose the ability to generate these setters! Maybe I am doing something wrong though!?

Any input would be appreciated.

cheers,
h.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: foreign keys, complexDataModel, and external schemas

Helge Weissig
It would help if my links actually hadn't been stripped :(

Here they are:

project on github: https://github.com/helgew/Torque-Schema-Test
schema files: https://github.com/helgew/Torque-Schema-Test/tree/master/src/main/torque/schema
generated base classes: https://github.com/helgew/Torque-Schema-Test/tree/master/target/generated-sources/torque/org/grajagan
getTblLinkInts() in BaseTbl3: https://github.com/helgew/Torque-Schema-Test/blob/master/target/generated-sources/torque/org/grajagan/BaseTbl3.java#L168

cheers,
h.

On Feb 28, 2012, at 6:47 PM, Helge Weissig wrote:

> Hi,
>
> I just ran into what may be a feature or a bug... trying to find out which: When I define a table in schema1.xml and another two, including a  link table for a many-to-many relationship in schema2.xml, where schema2.xml includes schema1.xml as an external schema, torque will not generated the getter methods for the foreign keys.
>
> To illustrate, I have created a github project. As you will see, there are two schema files: first-schema.xml and second-schema.xml which includes the first. The generated base classes for tbl1 and tbl3 differ in that BaseTbl3 has the getter methods for the link table tbl_link_int (e.g. getTblLinkInts()), whereas BaseTbl1 does not.
>
> I think it would be a very useful feature to be able to split a large schema into several sub-schema files and not lose the ability to generate these setters! Maybe I am doing something wrong though!?
>
> Any input would be appreciated.
>
> cheers,
> h.


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: foreign keys, complexDataModel, and external schemas

Thomas Fox-2
In reply to this post by Helge Weissig
Hi Helge,

>    I just ran into what may be a feature or a bug... trying to find
> out which: When I define a table in schema1.xml and another two,
> including a  link table for a many-to-many relationship in
> schema2.xml, where schema2.xml includes schema1.xml as an external
> schema, torque will not generated the getter methods for the foreign
keys.

This behaviour is by design. I was not around when this decision was made
but the idea is that a "external" schema is references which has no
knowledge of the referencing schema.

> To illustrate, I have created a github project. As you will see,
> there are two schema files: first-schema.xml and second-schema.xml
> which includes the first. The generated base classes for tbl1 and
> tbl3 differ in that BaseTbl3 has the getter methods for the link
> table tbl_link_int (e.g. getTblLinkInts()), whereas BaseTbl1 does not.
>
> I think it would be a very useful feature to be able to split a
> large schema into several sub-schema files and not lose the ability
> to generate these setters! Maybe I am doing something wrong though!?

This would be a different feature. Something like <import-schema.... />

You can create a jira issue for it. Personally I regard this as a sueful
feature so there is a good probability that it will be implemented for
Torque 4.

    Cheers,

      Thomas


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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: foreign keys, complexDataModel, and external schemas

Helge Weissig
Thanks Thomas! I created TORQUE-183 at https://issues.apache.org/jira/browse/TORQUE-183 .

cheers,
h.

On Feb 29, 2012, at 1:09 AM, Thomas Fox wrote:

> Hi Helge,
>
>>   I just ran into what may be a feature or a bug... trying to find
>> out which: When I define a table in schema1.xml and another two,
>> including a  link table for a many-to-many relationship in
>> schema2.xml, where schema2.xml includes schema1.xml as an external
>> schema, torque will not generated the getter methods for the foreign
> keys.
>
> This behaviour is by design. I was not around when this decision was made
> but the idea is that a "external" schema is references which has no
> knowledge of the referencing schema.
>
>> To illustrate, I have created a github project. As you will see,
>> there are two schema files: first-schema.xml and second-schema.xml
>> which includes the first. The generated base classes for tbl1 and
>> tbl3 differ in that BaseTbl3 has the getter methods for the link
>> table tbl_link_int (e.g. getTblLinkInts()), whereas BaseTbl1 does not.
>>
>> I think it would be a very useful feature to be able to split a
>> large schema into several sub-schema files and not lose the ability
>> to generate these setters! Maybe I am doing something wrong though!?
>
> This would be a different feature. Something like <import-schema.... />
>
> You can create a jira issue for it. Personally I regard this as a sueful
> feature so there is a good probability that it will be implemented for
> Torque 4.
>
>    Cheers,
>
>      Thomas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


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

Loading...