Hallöle Thomas,
I don't think that there is really a problem with torque and mysql. Normally
everything is fine, but at that time something like this, doesn't worked:
<table name="tableA">
<column name="id" required="true" type="BIGINT" primaryKey="true"
autoIncrement="true"/>
<column name="tableB_id" required="true" type="BIGINT"/>
<index name="tableB_index">
<index-column name="tableB_id"/>
</index>
<foreign-key foreignTable="tableB">
<reference local="tableB_id" foreign="id"/>
</foreign-key>
</table>
<table name="tableB">
<column name="id" required="true" type="BIGINT" primaryKey="true"
autoIncrement="true"/>
<column name="tableA_id" type="BIGINT"/>
<index name="tableA_index">
<index-column name="tableA_id"/>
</index>
<foreign-key foreignTable="tableA">
<reference local="tableA_id" foreign="id"/>
</foreign-key>
</table>
MySQL will quit this with an error, because it doesn't know tableB during the
"CREATE TABLE tableA". So it's not a bug. But it could be a feature :-).
I looked into the current subversion template and I think that the example
above doesn't work with the current version (including 3.2). But my locally
changed version is able to manage this. I think, it's better to upgrade my
local version to torque 3.2 and make then a patch.
bye
Thoralf
> -----Ursprüngliche Nachricht-----
> Von: Thomas Fischer [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 16. November 2005 10:20
> An: Apache Torque Users List
> Betreff: AW: SQL generated schema
>
>
> Thanks for the offer. I am not aware of problems with mysql
> at the moment, but I do not know the reason for not having
> any problems, cause the templates were not changed since
> then. I will look into it and maybe we'll come back to your offer.
>
> Thomas
>
> "Thoralf Rickert" <[EMAIL PROTECTED]> schrieb am 14.11.2005
> 11:09:48:
>
> >
> > > Some template sets for databases do not allow forward
> declarations
> > > on foreign key. So you have to make sure that the
> referenced table
> > > is before the referencing table in the schema.xml
> >
> > Ah, maybe it's not part of this thread but I remember that
> I had this
> > cross reference problem with Torque 3.1 & MySQL (1-2 years ago). At
> > that time I thought about a general way to avoid this problem. The
> > only solution that I found, was to change the templates. I
> knew that
> > it's possible to create first a simple table with the SQL CREATE
> > statement and after creating all tables the template creates ALTER
> > TABLE statements to change the foreign keys settings...
> >
> > I made this changes to my Torque 3.1 templates and was able to to
> > create tables with torque that have cross reference (now my schema
> > isn't sorted by references but alphabetical by the table
> name ;-). I
> > don't know, if it's possible to make this changes to all other
> > database types that torque supports but maybe for some.
> >
> > I would send my changes somebody (or to the developer list) if it
> > isn't already made in the torque 3.2 version (which I didn't tested
> > yet).
> >
> > bye
> > Thoralf
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]