[ https://issues.apache.org/jira/browse/OFBIZ-2459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708111#action_12708111 ]
responde commented on OFBIZ-2459: --------------------------------- Thanks for the reply, if you come to spain, madrid, is invited to a beer -----Mensaje original----- De: Scott Gray (JIRA) [mailto:j...@apache.org] Enviado el: lunes, 11 de mayo de 2009 14:30 Para: dhoyos...@yahoo.es Asunto: [jira] Closed: (OFBIZ-2459) getRelated only find one related [ https://issues.apache.org/jira/browse/OFBIZ-2459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Scott Gray closed OFBIZ-2459. ----------------------------- Resolution: Invalid you need to enter titles on the relations so that they are unique, e.g. <relation type="one" fk-name="reference1" title="REF1" rel-entity-name="TABLE2"> <relation type="one" fk-name="reference2" title="REF2" rel-entity-name="TABLE2"> you can then do: getRelated("REF1TABLE1") getRelated("REF2TABLE1") -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. > getRelated only find one related > -------------------------------- > > Key: OFBIZ-2459 > URL: https://issues.apache.org/jira/browse/OFBIZ-2459 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: Release Branch 4.0 > Environment: windows, linux, java 1.5 and java 1.6, mysql 5.0 and 5.1 > Reporter: david Cantero > > TABLE1with multiple foreign keys to another TABLE2 returns only one field > name . The database is mysql and the log shows the following message: > GenericDelegator.java:250:WARN ] [RelationNameNotUnique] Relation TABLE2 of > entity TABLE1 is not unique for that entity. > EXAMPLE CODE TO FIND RELATIONS: > > GenericValue table2element = findOne("TABLE2",utilMisc.toMap("table2id", > "10000"),false) > relationsList =table2element .getRelated("TABLE1") > The result is the first relation only => fk-name="reference1" > ENTITY MODEL DEFINITION <entitymodel.xml > > <entity entity-name="TABLE1" package-name="OT" title="Entity > for storing indicators"> > > <field name="indicatorId" type="id-ne"></field> > <field name="indicatorName" type="id-long-ne"></field> > <field name="reference1_to_table2" type="id"></field> > <field name="reference2_to_table2" type="id"></field> > > <prim-key field="indicatorId"/> > > <relation type="one" fk-name="reference1" > rel-entity-name="TABLE2"> > <key-map field-name="reference1_to_table2" > rel-field-name="table2id"/> > </relation> > > <relation type="one" fk-name="reference2" > rel-entity-name="TABLE2"> > <key-map field-name="reference2_to_table2" > rel-field-name="table2id"/> > </relation> > > </entity> > <entity entity-name="TABLE2" package-name="OT" title="table > 2 example"> > > <field name="table2id" type="id-ne"></field> > <field name="indicatorName" type="id-long-ne"></field> > > <prim-key field="table2id"/> > </entity> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.