ofbiz-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wei Zhang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OFBIZ-9428) getResultsSizeAfterPartialList() return wrong count with distinct() for View Entity
Date Tue, 29 Aug 2017 07:39:00 GMT

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

Wei Zhang commented on OFBIZ-9428:
----------------------------------

Hi Jacques, 

This fix causes a another problem. You may get the problem by the code below.

{code:borderStyle=solid}
    <view-entity entity-name="ExampleTypeView" package-name="org.apache.ofbiz.example.example">
        <member-entity entity-alias="EX" entity-name="Example"/>
        <alias entity-alias="EX" name="exampleId" field="exampleId" />
        <alias entity-alias="EX" name="exampleTypeId" group-by="true"/>
    </view-entity>

    EntityQuery.use(delegator).from("ExampleTypeView").queryList()

{code}

And the error message is:

2017-08-29 10:27:09,990 |jsse-nio-8443-exec-3 |GenericDelegator              |E| Failure in
findByCondition operation for entity [ExampleTypeView]: org.apache.ofbiz.entity.GenericDataSourceException:
SQL Exception while executing the following:SELECT EX.EXAMPLE_ID, EX.EXAMPLE_TYPE_ID FROM
public.EXAMPLE EX GROUP BY EX.EXAMPLE_TYPE_ID (ERROR: column "ex.example_id" must appear in
the GROUP BY clause or be used in an aggregate function
  Position: 8). Rolling back transaction.
org.apache.ofbiz.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT
EX.EXAMPLE_ID, EX.EXAMPLE_TYPE_ID FROM public.EXAMPLE EX GROUP BY EX.EXAMPLE_TYPE_ID (ERROR:
column "ex.example_id" must appear in the GROUP BY clause or be used in an aggregate function
  Position: 8)
        at org.apache.ofbiz.entity.jdbc.SQLProcessor.executeQuery(SQLProcessor.java:446) ~[ofbiz.jar:?]
        at org.apache.ofbiz.entity.datasource.GenericDAO.selectListIteratorByCondition(GenericDAO.java:869)
~[ofbiz.jar:?]
        at org.apache.ofbiz.entity.datasource.GenericHelperDAO.findListIteratorByCondition(GenericHelperDAO.java:141)
~[ofbiz.jar:?]
        at org.apache.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:1552) ~[ofbiz.jar:?]
        at org.apache.ofbiz.entity.GenericDelegator.findList(GenericDelegator.java:1586) [ofbiz.jar:?]
        at org.apache.ofbiz.entity.util.EntityQuery.query(EntityQuery.java:451) [ofbiz.jar:?]
        at org.apache.ofbiz.entity.util.EntityQuery.queryList(EntityQuery.java:381) [ofbiz.jar:?]
        at org.apache.ofbiz.entity.util.EntityQuery$queryList$1.call(Unknown Source) [ofbiz.jar:?]
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
[groovy-all-2.4.12.jar:2.4.12]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
[groovy-all-2.4.12.jar:2.4.12]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
[groovy-all-2.4.12.jar:2.4.12]
        at uk.co.robertheath.mobile.FooServices.getFoo(FooServices.groovy:31) [script:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112]

Kind Regards,

Wei


> getResultsSizeAfterPartialList() return wrong count with distinct() for View Entity
> -----------------------------------------------------------------------------------
>
>                 Key: OFBIZ-9428
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9428
>             Project: OFBiz
>          Issue Type: Bug
>    Affects Versions: Trunk
>            Reporter: Renuka Srishti
>            Assignee: Jacques Le Roux
>             Fix For: Release Branch 13.07, Release Branch 14.12, Release Branch 15.12,
16.11.04
>
>
> Here is the code sample to test the issue
> {code}
> EntityListIterator productAssocListItr = null;
> productAssocListItr = from("ProductAndAssoc").distinct().queryIterator();
> productAssocListSize = productAssocListItr.getResultsSizeAfterPartialList();
> {code}
> productAssocListSize will differ from the actual distinct records in the ProductAndAssoc
View Entity.
> This issue exists because it gives distinct records on the basis of the first column
in the table.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message