It is not broken wrt

<fk><ref1/><ref2/></fk>  at least I have that compiling fine in scarab.

It appears to be broken when the same <ref1/> is defined within another
<fk>.

john mcnally

Steve wrote:
> 
> Thanks for the reply.  I basically did what you suggested by leaving out the
> FK relations altogether and writing custom code to handle the relationships.
> It's annoying though, not to have the select joins, because a select from
> multiple tables forces one to parse the Village resultset directly.  C'est
> la vie.
> 
> My main reason for posting was I figured someone would have seen this before
> and had perhaps worked around it for themselves, since it really does appear
> that Torque is broken with regard to combination PKs.  Since I really want
> the join selets, I'll delve back into Object.vm and see what I can see.
> 
> Thanks again.
> Steve
> 
> -----Original Message-----
> From: jmcnally [mailto:jmcnally]On Behalf Of John McNally
> Sent: Friday, February 01, 2002 1:56 AM
> To: Turbine Users List
> Subject: Re: [REPOST] Problems getting a schema to compile using FKs
> (long!)
> 
> Your xml looks correct.  I have not tested the case you describe.  If
> you are unable to debug Object.vm, I can only suggest that you use
> complexObjectModel=false in torque.properties (or build.properties?)
> This will give you much simpler objects which do not attempt to
> construct relationships through the fk's.  Also, since you are not using
> the sql, an alternative is to leave out the second foreign key relation
> and writing custom code to deal with it.
> 
> john mcnally
> 
> Steve wrote:
> >
> > I posted this a couple of days back, but maybe it got lost in the deluge.
> > Can anyone help me out on this?  I'd really appreciate it.  Thanks.
> >
> > Steve
> >
> > -----Original Message-----
> > From: Steve [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, January 28, 2002 10:18 PM
> > To: Turbine-User
> > Subject: Problems getting a schema to compile using FKs (long!)
> >
> > Hi all:
> >
> > I could use a little (lot of!) help with this.  I've been attempting to
> > generate Peers for a "legacy" Oracle database (read "legacy" as changes to
> > the schema are problematic) and the Torque-generated classses won't
> compile.
> > Most of my problems seem to stem from having combination PKs that exist in
> > multiple relationships, which is perfectly valid, but Torque doesn't seem
> to
> > like it.
> >
> > Example:  Consider the following very simple schema of 3 entities: a
> Company
> > which may contain many Offices and many Employees.
> >
> > <database>
> >   <table name="COMPANY">
> >     <column name="CODE" required="true" primaryKey="true" size="15"
> > type="VARCHAR"/>
> >   </table>
> >   <table name="OFFICE">
> >     <column name="COMPANY_CODE" required="true" primaryKey="true"
> size="15"
> > type="VARCHAR"/>
> >     <column name="ID" required="true" primaryKey="true" size="5"
> > type="VARCHAR"/>
> >     <foreign-key foreignTable="COMPANY">
> >       <reference local="COMPANY_CODE" foreign="CODE"/>
> >     </foreign-key>
> >   </table>
> >   <table name="EMPLOYEE">
> >     <column name="ID" required="true" primaryKey="true" size="9"
> > type="VARCHAR"/>
> >     <column name="COMPANY_CODE" required="true" size="15" type="VARCHAR"/>
> >     <column name="OFFICE_ID" size="5" type="VARCHAR"/>
> >     <foreign-key foreignTable="OFFICE">
> >       <reference local="COMPANY_CODE" foreign="COMPANY_CODE"/>
> >       <reference local="OFFICE_ID" foreign="ID"/>
> >     </foreign-key>
> >     <foreign-key foreignTable="COMPANY">
> >       <reference local="COMPANY_CODE" foreign="CODE"/>
> >     </foreign-key>
> >   </table>
> > </database>
> >
> > But Torque has problems with the Employee entity, because its column,
> > company_code, exists in two FK relationships: one with Company and one
> with
> > Office.  This is a perfectly valid database design, however, if you
> consider
> > the following.  An employee's company_code is required, but his office_id
> is
> > optional; but if the office_id is entered, it should be constrained
> against
> > the values in the Office entity.
> >
> > Seems reasonable right?
> >
> > Here's the compile errors.  These appear in the getEmployees &
> > getEmployeesJoinOffice methods of BaseCompany.
> >
> >     [javac] D:\torque\src\java\adom\BaseCompany.java:313: cannot resolve
> > symbol
> >     [javac] symbol  : method getOfficeId  ()
> >     [javac] location: class adom.BaseCompany
> >     [javac]                    criteria.add(EmployeePeer.COMPANY_CODE,
> > getOfficeId() );
> >     [javac]                                                            ^
> >     [javac] D:\torque\src\java\adom\BaseCompany.java:314: cannot resolve
> > symbol
> >     [javac] symbol  : method getOfficeId  ()
> >     [javac] location: class adom.BaseCompany
> >     [javac]                    criteria.add(EmployeePeer.OFFICE_ID,
> > getOfficeId() );
> >     [javac]                                                         ^
> >     [javac] D:\torque\src\java\adom\BaseCompany.java:336: cannot resolve
> > symbol
> >     [javac] symbol  : method getOfficeId  ()
> >     [javac] location: class adom.BaseCompany
> >     [javac]                    criteria.add(EmployeePeer.COMPANY_CODE,
> > getOfficeId() );
> >     [javac]                                                            ^
> >     [javac] D:\torque\src\java\adom\BaseCompany.java:337: cannot resolve
> > symbol
> >     [javac] symbol  : method getOfficeId  ()
> >     [javac] location: class adom.BaseCompany
> >     [javac]                    criteria.add(EmployeePeer.OFFICE_ID,
> > getOfficeId() );
> >     [javac]                                                         ^
> >     [javac] D:\torque\src\java\adom\BaseCompany.java:377: cannot resolve
> > symbol
> >     [javac] symbol  : method getOfficeId  ()
> >     [javac] location: class adom.BaseCompany
> >     [javac]                    criteria.add(EmployeePeer.COMPANY_CODE,
> > getOfficeId() );
> >     [javac]                                                            ^
> >     [javac] D:\torque\src\java\adom\BaseCompany.java:378: cannot resolve
> > symbol
> >     [javac] symbol  : method getOfficeId  ()
> >     [javac] location: class adom.BaseCompany
> >     [javac]                    criteria.add(EmployeePeer.OFFICE_ID,
> > getOfficeId() );
> >     [javac]                                                         ^
> >     [javac] D:\torque\src\java\adom\BaseCompany.java:390: cannot resolve
> > symbol
> >     [javac] symbol  : method getOfficeId  ()
> >     [javac] location: class adom.BaseCompany
> >     [javac]                    criteria.add(EmployeePeer.COMPANY_CODE,
> > getOfficeId() );
> >     [javac]                                                            ^
> >     [javac] D:\torque\src\java\adom\BaseCompany.java:391: cannot resolve
> > symbol
> >     [javac] symbol  : method getOfficeId  ()
> >     [javac] location: class adom.BaseCompany
> >     [javac]                    criteria.add(EmployeePeer.OFFICE_ID,
> > getOfficeId() );
> >     [javac]                                                         ^
> >     [javac] 8 errors
> >
> > BUILD FAILED
> >
> > Based on the error messages, it looks like an error in the Object.vm
> > template.  I, however, wasn't programmer enough to figure out the
> template's
> > FK logic enough to be sure anything that I "fixed" wouldn't break
> something
> > else.  Can anyone else help?
> >
> > Steve
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

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

Reply via email to