This is an automated email from the ASF dual-hosted git repository.
struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git
The following commit(s) were added to refs/heads/master by this push:
new 813154a OPENJPA-2861 fix unit test
813154a is described below
commit 813154a570797b35a0c5d0469817775cd58ae525
Author: Mark Struberg <[email protected]>
AuthorDate: Mon May 3 17:06:22 2021 +0200
OPENJPA-2861 fix unit test
Boolean is the correct return value.
This should actually have been returned for all dictionaries.
The problem is that we always only return the _internal_ representation.
The reason is because CASE/WHEN can be used to return values, but also as
subquery.
Now imagine a database uses 0 and 1 for false and true. If CASE/WHEN is used
as subquery we really have to return 0/1 (number) because otherwise the
WHERE clause
would not fit. When not executing the query on a Entity, we do not know the
target type.
So there is probably no way we can later do a BooleanRepresentation call to
switch to boolean.
And this would also break existing applications.
---
.../jpql/expressions/TestJPQLScalarExpressions.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git
a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestJPQLScalarExpressions.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestJPQLScalarExpressions.java
index 597b947..95f5a8f 100644
---
a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestJPQLScalarExpressions.java
+++
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestJPQLScalarExpressions.java
@@ -223,11 +223,15 @@ public class TestJPQLScalarExpressions extends
AbstractTestCase {
result = (Object[]) rs.get(rs.size()-1);
- if (result[1] instanceof String)
+ if (result[1] instanceof String) {
assertEquals(result[1], "true");
- else
+ }
+ else if (result[1] instanceof Boolean) {
+ assertEquals(true, result[1]);
+ }
+ else {
assertEquals(result[1], 1);
-
+ }
startTx(em);
String update = "update CompUser c set c.creditRating = " +