You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by an...@apache.org on 2021/07/01 14:29:14 UTC
[syncope] branch master updated: adding parenthesis to perform the
correct query while searching by plainAttrValue
This is an automated email from the ASF dual-hosted git repository.
andreapatricelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/master by this push:
new 3a4cdb4 adding parenthesis to perform the correct query while searching by plainAttrValue
3a4cdb4 is described below
commit 3a4cdb46aab775e286e6eca3c4d963c04251188c
Author: Andrea Patricelli <an...@apache.org>
AuthorDate: Thu Jul 1 16:22:00 2021 +0200
adding parenthesis to perform the correct query while searching by plainAttrValue
---
.../org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
index bc529dd..74ba5c1 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/AbstractAnyDAO.java
@@ -188,7 +188,7 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A> im
private Query findByPlainAttrValueQuery(final String entityName, final boolean ignoreCaseMatch) {
String query = "SELECT e FROM " + entityName + " e"
- + " WHERE e.attribute.schema.id = :schemaKey AND (e.stringValue IS NOT NULL"
+ + " WHERE e.attribute.schema.id = :schemaKey AND ((e.stringValue IS NOT NULL"
+ " AND "
+ (ignoreCaseMatch ? "LOWER(" : "") + "e.stringValue" + (ignoreCaseMatch ? ")" : "")
+ " = "
@@ -196,7 +196,7 @@ public abstract class AbstractAnyDAO<A extends Any<?>> extends AbstractDAO<A> im
+ " OR (e.booleanValue IS NOT NULL AND e.booleanValue = :booleanValue)"
+ " OR (e.dateValue IS NOT NULL AND e.dateValue = :dateValue)"
+ " OR (e.longValue IS NOT NULL AND e.longValue = :longValue)"
- + " OR (e.doubleValue IS NOT NULL AND e.doubleValue = :doubleValue)";
+ + " OR (e.doubleValue IS NOT NULL AND e.doubleValue = :doubleValue))";
return entityManager().createQuery(query);
}