[ 
https://issues.apache.org/jira/browse/OFBIZ-4781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262382#comment-13262382
 ] 

Wojciech Szymanowski commented on OFBIZ-4781:
---------------------------------------------

Hi,
thank You for your answer.
Entity example:
        <view-entity entity-name="PartyAndCustomerRoleType"
                package-name="org.ofbiz.customerslci">
                <member-entity entity-alias="RT" entity-name="RoleType" />
                <member-entity entity-alias="PR" entity-name="PartyRole" />
                <alias entity-alias="PR" name="partyId"></alias>
                <alias entity-alias="RT" name="roleDescription" 
field="description" />
                <alias entity-alias="RT" name="roleTypeId" />
                <alias entity-alias="RT" name="parentTypeId" />
                <view-link entity-alias="RT" rel-entity-alias="PR">
                        <key-map field-name="roleTypeId" />
                        <entity-condition>
                                <condition-expr field-name="parentTypeId" 
value="CUSTOMER" />
                        </entity-condition>
                </view-link>
        </view-entity>

The final db query should look like this:

SELECT pr.party_id AS pr_party_id, rt.description AS rt_description,
                 rt.role_type_id AS rt_role_type_id,
                 rt.parent_type_id AS rt_parent_type_id
            FROM PUBLIC.role_type rt INNER JOIN PUBLIC.party_role pr
                 ON rt.role_type_id = pr.role_type_id
               AND (rt.parent_type_id = 'CUSTOMER')

but ofbiz does not generate condition for condition-expr tag (rt.parent_type_id 
= 'CUSTOMER').

I have looked into code and I think the missing code is in:
F:\projekty\lci\ofbiz\framework\entity\src\org\ofbiz\entity\jdbc\SqlJdbcUtil.java
 line 180.

Now (in 11.04 release) there is only a comment at this line:
                    // TODO add expression from entity-condition on view-link

Thanks,
Wojciech

                
> entitymodel - entity-condition inside view-link does not work
> -------------------------------------------------------------
>
>                 Key: OFBIZ-4781
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4781
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release Branch 11.04
>         Environment: Win Xp, java 1.6.0_23
>            Reporter: Wojciech Szymanowski
>              Labels: entity-condition, view-link
>
> Inside entitymodel.xml file - when I put entity-condition tag inside 
> view-link tag it does not affect db query at all. Condition from 
> entity-condition tag should be added to join statement. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to