Sergio, I have already submitted a patch to fix part of this issue. (Single foreign key to same table or "parent key" not maintaining a collection)
http://scarab.werken.com/issues/id/TRQS186 I haven't heard from anyone as to whether it will be committed. Also, this is a fix to ObjectWithManager.vm, I didn't bother to fix Object.vm since I wasn't using it. Good luck, Gary -----Original Message----- From: Sergio Berná [mailto:[EMAIL PROTECTED] Sent: Thu 10/2/2003 7:44 AM To: 'Apache Torque Developers List' Cc: Subject: RE: problem with double foreign key, possible bug Hello again, I have been further tracing the problem and i have reached the following conclusion. The problem always arises with foreign keys that have shared values among them. In this case the object.vm templates doesn’t know how to correctly handle the references between the relations for the setter methods that apply to columns shared among the foreign keys to the target table and the method $colFK.isMultipleFK() return false, setting wrong the name for the collection at this stage (not relatedby one). I suppose the correction should be to correctly identify in the .isMultipleFK() method that this column belongs to 2 foreign keys (althought it is shared among them) An example of the last could be the next: Table a: Company,item Table b: Company,item,itemchild b.(company,item) --> a.(company,item) b.(company,itemchild) --> b.(company,item) public setCompany(...){ //in this method the name for the b related collection is wrong. } Thx again. Sergio Berna. -----Mensaje original----- De: Sergio Berná [mailto:[EMAIL PROTECTED] Enviado el: jueves, 02 de octubre de 2003 16:01 Para: [EMAIL PROTECTED] Asunto: problem with double foreign key, possible bug Hello, Im not sure if this should be post here or in the users list, but I have found a problem while using Torque with a double foreign key to the same table. The table definitions are like this: <table name="CATALOGITEM" javaName="G3CatalogItem"> <column name="PKID" type="INTEGER" size="10" required="true" primaryKey="true"/> <column name="IDCOMPANY" type="INTEGER" size="10" required="true" primaryKey="true"/> <column name="IDCONTRACT" type="INTEGER" size="10" required="true" primaryKey="true"/> <column name="IDSERVICE" type="INTEGER" size="10" required="true" primaryKey="true"/> <column name="IDITEM" type="INTEGER" required="true" primaryKey="true" autoincrement="true"/> <column name="TIMESTAMPDATA" type="TIMESTAMP" default=""/> <foreign-key name="FK_CI_SERVICE" onDelete="CASCADE" foreignTable="SERVICES"> <reference local="PKID" foreign="PKID"/> <reference local="IDCOMPANY" foreign="IDCOMPANY"/> <reference local="IDCONTRACT" foreign="IDCONTRACT"/> <reference local="IDSERVICE" foreign="IDSERVICE"/> </foreign-key> </table> <table name="CATALOGITEMRELATION" javaName="G3CatalogItemRelation"> <column name="PKID" type="INTEGER" size="10" required="true" primaryKey="true"/> <column name="IDCOMPANY" type="INTEGER" size="10" required="true" primaryKey="true"/> <column name="IDCONTRACT" type="INTEGER" size="10" required="true" primaryKey="true"/> <column name="IDSERVICE" type="INTEGER" size="10" required="true" primaryKey="true"/> <column name="IDITEM" type="INTEGER" required="true" primaryKey="true"/> <column name="IDITEMCHILD" type="INTEGER" required="true" primaryKey="true"/> <column name="IDRELATION" type="INTEGER" required="true" primaryKey="true"/> <foreign-key name="FK_CIR_CIRP" onDelete="CASCADE" foreignTable="CATALOGITEM"> <reference local="PKID" foreign="PKID"/> <reference local="IDCOMPANY" foreign="IDCOMPANY"/> <reference local="IDCONTRACT" foreign="IDCONTRACT"/> <reference local="IDSERVICE" foreign="IDSERVICE"/> <reference local="IDITEM" foreign="IDITEM"/> </foreign-key> <foreign-key name="FK_CIR_CIRC" onDelete="CASCADE" foreignTable="CATALOGITEM"> <reference local="PKID" foreign="PKID"/> <reference local="IDCOMPANY" foreign="IDCOMPANY"/> <reference local="IDCONTRACT" foreign="IDCONTRACT"/> <reference local="IDSERVICE" foreign="IDSERVICE"/> <reference local="IDITEMCHILD" foreign="IDITEM"/> </foreign-key> <foreign-key name="FK_CIR_CIRS" onDelete="CASCADE" foreignTable="CATALOGITEMRELATIONSCHEMA"> <reference local="PKID" foreign="PKID"/> <reference local="IDCOMPANY" foreign="IDCOMPANY"/> <reference local="IDCONTRACT" foreign="IDCONTRACT"/> <reference local="IDSERVICE" foreign="IDSERVICE"/> <reference local="IDRELATION" foreign="IDRELATION"/> </foreign-key> </table> In this schema im trying to build a relation between 2 catalog items.I need 2 foreign keys in the relation table pointing to the same primary key in the catalogitem table so that I can locate the parent and the childs. If I don’t use the comnplex object model then everything is fine, but when I select complex object model, then torque doesn’t create the variables and collections that belongs to both relations (it just creates one). Besides it uses them both when updating the related values. This results in a huge compilation error trace such as the next one: xtd\logic\catalog\database\BaseG3CatalogItem.java:133: cannot resolve symbol symbol : variable collG3CatalogItemRelations location: class xtd.logic.catalog.database.BaseG3CatalogItem if (collG3CatalogItemRelations != null) ^ xtd\logic\catalog\database\BaseG3CatalogItem.java:135: cannot resolve symbol symbol : variable collG3CatalogItemRelations location: class xtd.logic.catalog.database.BaseG3CatalogItem for (int i = 0; i < collG3CatalogItemRelations.size(); i++) ^ xtd\logic\catalog\database\BaseG3CatalogItem.java:137: cannot resolve symbol symbol : variable collG3CatalogItemRelations location: class xtd.logic.catalog.database.BaseG3CatalogItem ((G3CatalogItemRelation) collG3CatalogItemRelations.get(i)) ^ xtd\logic\catalog\database\BaseG3CatalogItem.java:143: cannot resolve symbol symbol : variable collG3CatalogItemRelations location: class xtd.logic.catalog.database.BaseG3CatalogItem if (collG3CatalogItemRelations != null) ….. Am I doing something wrong? Thx for your time, btw torque is becoming one of my favourite tools for database design and access, great product. Sergio Berna --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.521 / Virus Database: 319 - Release Date: 23/09/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.521 / Virus Database: 319 - Release Date: 23/09/2003 Advertencia legal: Este mensaje y, en su caso, los ficheros anexos son confidenciales, especialmente en lo que respecta a los datos personales, y se dirigen exclusivamente al destinatario referenciado. Si usted no lo es y lo ha recibido por error o tiene conocimiento del mismo por cualquier motivo, le rogamos que nos lo comunique por este medio y proceda a destruirlo o borrarlo, y que en todo caso se abstenga de utilizar, reproducir, alterar, archivar o comunicar a terceros el presente mensaje y ficheros anexos, todo ello bajo pena de incurrir en responsabilidades legales. El emisor no garantiza la integridad, rapidez o seguridad del presente correo, ni se responsabiliza de posibles perjuicios derivados de la captura, incorporaciones de virus o cualesquiera otras manipulaciones efectuadas por terceros. Advertiment legal: Aquest missatge i, si escau, els fitxers annexos tenen caire confidencial, especialment pel que fa a les dades personals, i s'adrecen exclusivament al destinatari referenciat. Si no es tracta d'aquest i l'ha rebut per error o se li ha fet arribar per qualsevol motiu, li preguem que ens ho comuniqui per aquesta mateixa via i el destrueixi o l'esborri, i que en tot cas s'abstingui d'utilitzar, reproduir, alterar, arxivar o comunicar a tercers aquest missatge i fitxers annexos, tot sota pena d'entrar en responsabilitats legals. L'emissor no garanteix la integritat, la rapidesa o la seguretat d'aquest correu, ni es responsabilitza de possibles perjudicis derivats de la captura, incorporacions de virus o qualsevol altres manipulacions que facin tercers. Disclaimer: This message and any attached files transmitted with it, is confidential, especially as regards personal data. It is intended solely for the use of the individual or entity to whom it is addressed. If you are not the intended recipient and have received this information in error or have accessed it for any reason, please notify us of this fact by email reply and then destroy or delete the message, refraining from any reproduction, use, alteration, filing or communication to third parties of this message and attached files on penalty of incurring legal responsibilities. The sender does not guarantee the integrity, the accuracy, the swift delivery or the security of this email transmission, and assumes no responsibility for any possible damage incurred through data capture, virus incorporation or any manipulation carried out by third parties. --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.521 / Virus Database: 319 - Release Date: 23/09/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.521 / Virus Database: 319 - Release Date: 23/09/2003 Advertencia legal: Este mensaje y, en su caso, los ficheros anexos son confidenciales, especialmente en lo que respecta a los datos personales, y se dirigen exclusivamente al destinatario referenciado. Si usted no lo es y lo ha recibido por error o tiene conocimiento del mismo por cualquier motivo, le rogamos que nos lo comunique por este medio y proceda a destruirlo o borrarlo, y que en todo caso se abstenga de utilizar, reproducir, alterar, archivar o comunicar a terceros el presente mensaje y ficheros anexos, todo ello bajo pena de incurrir en responsabilidades legales. El emisor no garantiza la integridad, rapidez o seguridad del presente correo, ni se responsabiliza de posibles perjuicios derivados de la captura, incorporaciones de virus o cualesquiera otras manipulaciones efectuadas por terceros. Advertiment legal: Aquest missatge i, si escau, els fitxers annexos tenen caire confidencial, especialment pel que fa a les dades personals, i s'adrecen exclusivament al destinatari referenciat. Si no es tracta d'aquest i l'ha rebut per error o se li ha fet arribar per qualsevol motiu, li preguem que ens ho comuniqui per aquesta mateixa via i el destrueixi o l'esborri, i que en tot cas s'abstingui d'utilitzar, reproduir, alterar, arxivar o comunicar a tercers aquest missatge i fitxers annexos, tot sota pena d'entrar en responsabilitats legals. L'emissor no garanteix la integritat, la rapidesa o la seguretat d'aquest correu, ni es responsabilitza de possibles perjudicis derivats de la captura, incorporacions de virus o qualsevol altres manipulacions que facin tercers. Disclaimer: This message and any attached files transmitted with it, is confidential, especially as regards personal data. It is intended solely for the use of the individual or entity to whom it is addressed. If you are not the intended recipient and have received this information in error or have accessed it for any reason, please notify us of this fact by email reply and then destroy or delete the message, refraining from any reproduction, use, alteration, filing or communication to third parties of this message and attached files on penalty of incurring legal responsibilities. The sender does not guarantee the integrity, the accuracy, the swift delivery or the security of this email transmission, and assumes no responsibility for any possible damage incurred through data capture, virus incorporation or any manipulation carried out by third parties. --------------------------------------------------------------------- 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]
