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.

Reply via email to