There can't be a "ignore missing forgeign key" option.  This
is because if you define a forgeign key in Torque, it adds 
methods to support the relationship.  The methods depend on 
having the generated classes for the forgeign key table, so
ignoring it will lead to compile time errors.

You have a couple of choices here.  First, why not just add
the schema definitions for the tables?  If you use the jdbc
ant task (I think that's the one), you can extract 90% of 
the schema info you need (still might need some minor 
tweaking to be accurate).

One variation of this is to use different schema xml file 
for the "external" db schema and a project schema xml file
for your application objects.  Look thru the docs for info
on how to have multiple DB schema files that can be linked.

The other option is to just not define those fields as being
forgeign keys in the XML schema.  If you need special 
processing when using them, just override the base set/get 
methods in the Table.java subclass.

> -----Original Message-----
> From: Francois Guitton [mailto:[EMAIL PROTECTED] 
> Sent: Friday, February 17, 2006 8:34 AM
> To: torque-user@db.apache.org
> Subject: Creating foreign key constraints on tables that 
> already exists in the database
> 
> 
> Hi
> 
>  
> 
> Is there a way with the generator to create new tables that 
> have foreign key that reference already existing tables?
> 
>  
> 
> E.g. I have a database where the tables Product  (primary key 
> product_id) and Client (primary key client_id) already exists. 
> 
> Now I want to use the generator to create a joined table 
> Product_Client that have two foreign keys
> 
> So my xml would look like
> 
>   <table idMethod="native" name="Product_Client">
> 
>     <column name="product_client_id" primaryKey="true" 
> required="true" type="INTEGER"/>
> 
>     <column name="product_id" required="true" type="INTEGER"/>
> 
>     <column name="client_id" required="true" type="INTEGER"/>
> 
>         <foreign-key foreignTable="Client">
> 
>             <reference foreign="client_id" local="client_id"/>
> 
>         </foreign-key>
> 
>         <foreign-key foreignTable="Product">
> 
>             <reference foreign="product_id" local="product_id"/>
> 
>         </foreign-key>
> 
>   </table>
> 
>  
> 
> Torque doesn't like it when generating the sql as it doesn't 
> find the referenced tables. Could there be an option in 
> Torque where it just generates a warning that the table does 
> not exist but still create the sql?
> 
>  
> 
>  
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to