OFBiz
  1. OFBiz
  2. OFBIZ-4781

entitymodel - entity-condition inside view-link does not work

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: Release Branch 11.04
    • Fix Version/s: None
    • Component/s: framework
    • Environment:

      Win Xp, java 1.6.0_23

      Description

      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.

        Activity

        Hide
        Jacques Le Roux added a comment -

        My bad, I did not mention here this was reverted in
        R10.04 r1331271
        R11.04 r1331272

        Daniel mentionned above that

        Hi, I took a closer look to this and found that it is implemented in trunk but not in 11.04.
        In 11.04 instead of the comment you mentioned the following code appears:

        So since R10.04 and R11.04 are no longer supported by us, interested people should take care of the problem themselves.

        Show
        Jacques Le Roux added a comment - My bad, I did not mention here this was reverted in R10.04 r1331271 R11.04 r1331272 Daniel mentionned above that Hi, I took a closer look to this and found that it is implemented in trunk but not in 11.04. In 11.04 instead of the comment you mentioned the following code appears: So since R10.04 and R11.04 are no longer supported by us, interested people should take care of the problem themselves.
        Hide
        Divesh Dutta added a comment -

        This is not an issue on trunk. What should we do for all those issues, which are not in trunk and latest branches? For example, this issue is on 11.04 which is bit old now.

        Show
        Divesh Dutta added a comment - This is not an issue on trunk. What should we do for all those issues, which are not in trunk and latest branches? For example, this issue is on 11.04 which is bit old now.
        Hide
        Jacques Le Roux added a comment -

        Thanks to Amit Sharma who called me, this needed to be reverted: does not compile

        Show
        Jacques Le Roux added a comment - Thanks to Amit Sharma who called me, this needed to be reverted: does not compile
        Hide
        Jacques Le Roux added a comment -

        Backported from trunk at r1327735

        R11.04 r1331251
        R10.04 r1331250

        Show
        Jacques Le Roux added a comment - Backported from trunk at r1327735 R11.04 r1331251 R10.04 r1331250
        Hide
        Pierre Smits added a comment -

        Release 11.04.01 is expected to be made available to the public after May 15, 2012

        Show
        Pierre Smits added a comment - Release 11.04.01 is expected to be made available to the public after May 15, 2012
        Hide
        Daniel Riquelme added a comment -

        Hi, I took a closer look to this and found that it is implemented in trunk but not in 11.04.
        In 11.04 instead of the comment you mentioned the following code appears:

        ModelViewEntity.ViewEntityCondition viewEntityCondition = viewLink.getViewEntityCondition();
        if (viewEntityCondition != null) {
        EntityCondition whereCondition = viewEntityCondition.getWhereCondition(modelFieldTypeReader, null);
        if (whereCondition != null)

        { condBuffer.append(" AND "); condBuffer.append(whereCondition.makeWhereString(modelEntity, null, datasourceInfo)); }

        }

        I haven't tested this code in 11.04 so I can't tell you if any other modification is needed.

        I can't tell you wether this code will get any time soon to 11.04, perhaps if you ask this on the dev list you may get a better answer.

        Show
        Daniel Riquelme added a comment - Hi, I took a closer look to this and found that it is implemented in trunk but not in 11.04. In 11.04 instead of the comment you mentioned the following code appears: ModelViewEntity.ViewEntityCondition viewEntityCondition = viewLink.getViewEntityCondition(); if (viewEntityCondition != null) { EntityCondition whereCondition = viewEntityCondition.getWhereCondition(modelFieldTypeReader, null); if (whereCondition != null) { condBuffer.append(" AND "); condBuffer.append(whereCondition.makeWhereString(modelEntity, null, datasourceInfo)); } } I haven't tested this code in 11.04 so I can't tell you if any other modification is needed. I can't tell you wether this code will get any time soon to 11.04, perhaps if you ask this on the dev list you may get a better answer.
        Hide
        Wojciech Szymanowski added a comment -

        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

        Show
        Wojciech Szymanowski added a comment - 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
        Hide
        Daniel Riquelme added a comment -

        Hi, it works for me.
        Could you post the entity view that gave you the problem ?

        Show
        Daniel Riquelme added a comment - Hi, it works for me. Could you post the entity view that gave you the problem ?

          People

          • Assignee:
            Jacques Le Roux
            Reporter:
            Wojciech Szymanowski
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development