You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by "Michael Bouschen (Jira)" <ji...@apache.org> on 2024/09/15 08:39:00 UTC

[jira] [Commented] (JDO-843) JDOQLTypedQuery: issue with candidate("this") method

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

Michael Bouschen commented on JDO-843:
--------------------------------------

To reprocude the issue please checkout branch JDO-843 of the Apache JDO repository [https://github.com/apache/db-jdo/tree/JDO-843]. The branch includes the test class JDO843Test that just has the failing methods testQuery15f and testQuery16f.
Please run the following command:
{{mvn -Djdo.tck.cfglist=JDO843.conf clean install}}
You find the results in the directory tck/target/logs/ files app-JDO843-junit.txt or dsid-JDO843-junit.txt.

Please note, that with the latest checkin there are diffrent testcases for success (testQuery15fSuccess / testQuery16fSuccess) and failure (testQuery15fFailure / testQuery16fFailure).

Please also note, I put the JUnit @Test annotation in comments for the two success methods. When running the success methods together with the failure methods all 4 methods return the expected result. When running the failure mthods w/o the success methods the twi failure methods return the unexpected result.

> JDOQLTypedQuery: issue with candidate("this") method
> ----------------------------------------------------
>
>                 Key: JDO-843
>                 URL: https://issues.apache.org/jira/browse/JDO-843
>             Project: JDO
>          Issue Type: Bug
>          Components: tck
>    Affects Versions: JDO 3.2.1
>            Reporter: Michael Bouschen
>            Priority: Major
>
> TCK Class {color:#000000}SampleReadQueries implements the sample queries from the JDO specification chapter 14.11.{color}
> {color:#000000}Methods testQuery15f and testQuery16f implement the typesafe query version. The code uses QFullTimeEmployee.candidate() to access instances of the candidate class. The query returns a wrong query result, When replacing the call 
>   {color}{color:#000000}QFullTimeEmployee.candidate() by 
>   QFullTimeEmployee.candidate("this")
> The expected query result consist of three {color}{color:#000000}FullTimeEmployee instances wrapped into a EmpWrapper instance (testQuery15f) or {color}EmpInfo instance ({color:#000000}testQuery16f{color}). Instead the {color:#000000}FullTimeEmployee instance is null that gets wrappe into a EmpWrapper/EmpInfo.{color}
> {color:#000000}The generated SQL does not differ depending on which candidate method is used.{color}
> {color:#000000}Junit Test results when running the test Methods with QFullTimeEmployee.candidate("this"):{color}
> {color:#000000}{{{{{}  JUnit Jupiter:JDO843Test:testQuery15f(){}}}}}
> {{{{{}    MethodSource [className = 'org.apache.jdo.tck.query.api.JDO843Test', methodName = 'testQuery15f', methodParameterTypes = '']{}}}}}
> {{{{    => org.opentest4j.AssertionFailedError: Assertion (SampleQueries) failed: }}}}
> {{{{{}Wrong query result: {}}}}}
> {{{{{}query: select into org.apache.jdo.tck.query.api.SampleReadQueries$EmpWrapper from org.apache.jdo.tck.pc.company.FullTimeEmployee where salary > :sal{}}}}}
> {{{{{}expected: java.util.ArrayList of size 3{}}}}}
> [EmpWrapper(FullTimeEmployee:name = Michael), EmpWrapper(FullTimeEmployee:name = Craig), EmpWrapper(FullTimeEmployee:name = Tillmann)]
> {{{{{}got:      java.util.ArrayList of size 3{}}}}}
> [EmpWrapper(FullTimeEmployee:null), EmpWrapper(FullTimeEmployee:null), EmpWrapper(FullTimeEmployee:null)]
> {{{{{}  JUnit Jupiter:JDO843Test:testQuery16f(){}}}}}
> {{{{{}    MethodSource [className = 'org.apache.jdo.tck.query.api.JDO843Test', methodName = 'testQuery16f', methodParameterTypes = '']{}}}}}
> {{{{    => org.opentest4j.AssertionFailedError: Assertion (SampleQueries) failed: }}}}
> {{{{{}Wrong query result: {}}}}}
> {{{{{}query: select into org.apache.jdo.tck.query.api.SampleReadQueries$EmpInfo from org.apache.jdo.tck.pc.company.FullTimeEmployee where salary > :sal{}}}}}
> {{{{{}expected: java.util.ArrayList of size 3{}}}}}
> [EmpInfo(worker:Michael), EmpInfo(worker:Craig), EmpInfo(worker:Tillmann)]
> {{{{{}got:      java.util.ArrayList of size 3{}}}}}
> [EmpInfo(worker:null), EmpInfo(worker:null), EmpInfo(worker:null)]{color}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)