If the repository interface is compiled with -parameters argument, the parameter.isNamePresent() returns true in reflection utils. This is not handled properly in getParams and getBy methods.
Examples of problematic cases:
Jakarta Data TCK
In the Jakarta Data TCK, the test EntityTests.testFindList produces a wrong SelectQuery for semi-structured databases. PositiveIntegers.findOdd method contains 2 special parameters of type Limit and Sort. The resulting SelectQuery passed to the SemiStructuredTemplate methods contains an EQUALS condition, which contains 4 elements, instead of 2. The elements should contain only the 2 compared values, but they also contain the other 2 special parameters. This is because the TCK code is compiled with -parameters, the 2 special parameters thus have a name but aren't ignored when elements list is created.
Queries with ? parameters
For example the PersonRepository.findAge method in RepositoryReflectionUtilsTest in jnosql-mapping-core module's unit tests. If the repository interface is compiled with -parameters, then the test shouldFindByAge fails. This is because the detected params will contain the parameter under its name and not under ?1.
JNoSQL Version
1.1.2-SNAPSHOT
Steps To Reproduce
Configure the jnosql-mapping-core module's compiler plugin to compile tests with the -parameters compiler argument. The test RepositoryReflectionUtilsTest.shouldFindByAge
Expected Results
Even if the repository interface is compiled with -parameters, query methods with @Query and ? parameters should raise parameters that contain the appropriate ? parameter. For example, @Query("FROM Person WHERE age = ?1") should result in a query that has ?1 parameter.
Code example, screenshot, or link to a repository
To reproduce, add the following to the plugin configuration of the jnosql-mapping-core in pom.xml:
Which JNoSQL project the issue refers to?
JNoSQL (Core)
Bug description
If the repository interface is compiled with
-parameters
argument, theparameter.isNamePresent()
returnstrue
in reflection utils. This is not handled properly ingetParams
andgetBy
methods.Examples of problematic cases:
Jakarta Data TCK
In the Jakarta Data TCK, the test
EntityTests.testFindList
produces a wrongSelectQuery
for semi-structured databases.PositiveIntegers.findOdd
method contains 2 special parameters of typeLimit
andSort
. The resultingSelectQuery
passed to theSemiStructuredTemplate
methods contains anEQUALS
condition, which contains 4 elements, instead of 2. The elements should contain only the 2 compared values, but they also contain the other 2 special parameters. This is because the TCK code is compiled with-parameters
, the 2 special parameters thus have a name but aren't ignored when elements list is created.Queries with
?
parametersFor example the
PersonRepository.findAge
method inRepositoryReflectionUtilsTest
injnosql-mapping-core
module's unit tests. If the repository interface is compiled with-parameters
, then the testshouldFindByAge
fails. This is because the detected params will contain the parameter under its name and not under?1
.JNoSQL Version
1.1.2-SNAPSHOT
Steps To Reproduce
jnosql-mapping-core
module's compiler plugin to compile tests with the-parameters
compiler argument. The testRepositoryReflectionUtilsTest.shouldFindByAge
Expected Results
-parameters
, query methods with@Query
and?
parameters should raise parameters that contain the appropriate?
parameter. For example,@Query("FROM Person WHERE age = ?1")
should result in a query that has?1
parameter.Code example, screenshot, or link to a repository
To reproduce, add the following to the plugin configuration of the
jnosql-mapping-core
inpom.xml
:Then run
mvn clean test
.