diff --git a/hibernate6-core/pom.xml b/hibernate6-core/pom.xml index 0ce70078..152d244f 100644 --- a/hibernate6-core/pom.xml +++ b/hibernate6-core/pom.xml @@ -12,7 +12,7 @@ hibernate6-core - 6.1.5.Final + 6.4.0.Final 11 11 11 diff --git a/hibernate6-core/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/descriptor/CastOperatorFunctionDescriptor.java b/hibernate6-core/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/descriptor/CastOperatorFunctionDescriptor.java index 71fee780..6ef64a3d 100644 --- a/hibernate6-core/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/descriptor/CastOperatorFunctionDescriptor.java +++ b/hibernate6-core/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/descriptor/CastOperatorFunctionDescriptor.java @@ -28,7 +28,7 @@ public CastOperatorFunctionDescriptor(HibernateContext hibernateContext) { } @Override - public void render(SqlAppender sqlAppender, List sqlAstArguments, SqlAstTranslator translator) { + public void render(SqlAppender sqlAppender, List sqlAstArguments, ReturnableType returnableType, SqlAstTranslator translator) { //TODO Check if sqlAstArguments has two arguments only! boolean firstPass = true; for (Iterator var11 = sqlAstArguments.iterator(); var11.hasNext(); firstPass = false) { @@ -52,7 +52,7 @@ public void render(SqlAppender sqlAppender, List sqlAstArg } @Override - protected SelfRenderingSqmFunction generateSqmFunctionExpression(List> arguments, ReturnableType impliedResultType, QueryEngine queryEngine, TypeConfiguration typeConfiguration) { + protected SelfRenderingSqmFunction generateSqmFunctionExpression(List> arguments, ReturnableType impliedResultType, QueryEngine queryEngine) { List> args = new ArrayList<>(); //TODO Check if arguments has two arguments only! for (int i = 0; i < arguments.size(); i++) { diff --git a/hibernate6/pom.xml b/hibernate6/pom.xml index 0d180740..0bbac67d 100644 --- a/hibernate6/pom.xml +++ b/hibernate6/pom.xml @@ -13,7 +13,7 @@ hibernate6 - 6.1.5.Final + 6.4.0.Final 11 11 11 diff --git a/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/AbstractJsonBExtractPath.java b/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/AbstractJsonBExtractPath.java index 3ad3f57d..327186f6 100644 --- a/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/AbstractJsonBExtractPath.java +++ b/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/AbstractJsonBExtractPath.java @@ -22,7 +22,9 @@ package com.github.starnowski.posjsonhelper.hibernate6; import jakarta.persistence.criteria.Path; +import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.sqm.NodeBuilder; +import org.hibernate.query.sqm.function.FunctionRenderer; import org.hibernate.query.sqm.function.FunctionRenderingSupport; import org.hibernate.query.sqm.function.SelfRenderingSqmFunction; import org.hibernate.query.sqm.produce.function.StandardFunctionReturnTypeResolvers; @@ -65,7 +67,7 @@ public AbstractJsonBExtractPath(Path referencedPathSource, NodeBuilder nodeBuild public AbstractJsonBExtractPath(Path referencedPathSource, List> path, NodeBuilder nodeBuilder, String functionName) { super(nodeBuilder.getQueryEngine().getSqmFunctionRegistry().findFunctionDescriptor(functionName), - (FunctionRenderingSupport) nodeBuilder.getQueryEngine().getSqmFunctionRegistry().findFunctionDescriptor(functionName), + (FunctionRenderer) nodeBuilder.getQueryEngine().getSqmFunctionRegistry().findFunctionDescriptor(functionName), contactParameters(referencedPathSource, (List>) path), null, null, @@ -79,7 +81,7 @@ private static List> mapPathParameters(NodeBuilder nod throw new IllegalArgumentException("Path argument can not be null or empty list"); } List> result = new ArrayList<>(); - result.addAll(path.stream().map(p -> nodeBuilder.value(p)).collect(Collectors.toList())); + result.addAll(path.stream().map(p -> (SqmTypedNode)nodeBuilder.value(p)).collect(Collectors.toList())); return result; } diff --git a/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/descriptor/AbstractJsonbArrayStringsExistPredicateDescriptor.java b/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/descriptor/AbstractJsonbArrayStringsExistPredicateDescriptor.java index 351c2698..ae53d7df 100644 --- a/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/descriptor/AbstractJsonbArrayStringsExistPredicateDescriptor.java +++ b/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/descriptor/AbstractJsonbArrayStringsExistPredicateDescriptor.java @@ -59,7 +59,7 @@ public AbstractJsonbArrayStringsExistPredicateDescriptor(String name, HibernateC abstract public String getSqmFunction(); @Override - protected SelfRenderingSqmFunction generateSqmFunctionExpression(List> arguments, ReturnableType impliedResultType, QueryEngine queryEngine, TypeConfiguration typeConfiguration) { + protected SelfRenderingSqmFunction generateSqmFunctionExpression(List> arguments, ReturnableType impliedResultType, QueryEngine queryEngine) { return generateJsonbArrayStringsExistPredicate(this.hibernateContext, queryEngine.getCriteriaBuilder(), (JsonBExtractPath) arguments.get(0), (JsonArrayFunction) arguments.get(1)); } } diff --git a/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/descriptor/JsonArrayFunctionDescriptor.java b/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/descriptor/JsonArrayFunctionDescriptor.java index 0dbe0a2f..953edd51 100644 --- a/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/descriptor/JsonArrayFunctionDescriptor.java +++ b/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/descriptor/JsonArrayFunctionDescriptor.java @@ -24,6 +24,7 @@ import com.github.starnowski.posjsonhelper.core.HibernateContext; import com.github.starnowski.posjsonhelper.hibernate6.operators.JsonArrayFunction; import org.hibernate.query.ReturnableType; +import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.spi.QueryEngine; import org.hibernate.query.sqm.function.AbstractSqmSelfRenderingFunctionDescriptor; import org.hibernate.query.sqm.function.SelfRenderingSqmFunction; @@ -64,7 +65,7 @@ public JsonArrayFunctionDescriptor(HibernateContext hibernateContext) { } @Override - public void render(SqlAppender sqlAppender, List sqlAstArguments, SqlAstTranslator translator) { + public void render(SqlAppender sqlAppender, List sqlAstArguments, ReturnableType returnableType, SqlAstTranslator translator) { sqlAppender.appendSql(this.getName()); sqlAppender.appendSql("["); @@ -81,7 +82,7 @@ public void render(SqlAppender sqlAppender, List sqlAstArg } @Override - protected SelfRenderingSqmFunction generateSqmFunctionExpression(List> arguments, ReturnableType impliedResultType, QueryEngine queryEngine, TypeConfiguration typeConfiguration) { + protected SelfRenderingSqmFunction generateSqmFunctionExpression(List> arguments, ReturnableType impliedResultType, QueryEngine queryEngine) { List> args = new ArrayList<>(); for (int i = 0; i < arguments.size(); i++) { args.add((SqmExpression) arguments.get(i)); diff --git a/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/operators/JsonArrayFunction.java b/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/operators/JsonArrayFunction.java index a88abbea..61c3459b 100644 --- a/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/operators/JsonArrayFunction.java +++ b/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/operators/JsonArrayFunction.java @@ -22,7 +22,9 @@ package com.github.starnowski.posjsonhelper.hibernate6.operators; import com.github.starnowski.posjsonhelper.core.HibernateContext; +import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.sqm.NodeBuilder; +import org.hibernate.query.sqm.function.FunctionRenderer; import org.hibernate.query.sqm.function.FunctionRenderingSupport; import org.hibernate.query.sqm.function.SelfRenderingSqmFunction; import org.hibernate.query.sqm.produce.function.StandardFunctionReturnTypeResolvers; @@ -41,7 +43,7 @@ public class JsonArrayFunction extends SelfRenderingSqmFunction implemen public JsonArrayFunction(NodeBuilder nodeBuilder, List> arguments, HibernateContext hibernateContext) { super(nodeBuilder.getQueryEngine().getSqmFunctionRegistry().findFunctionDescriptor(hibernateContext.getJsonFunctionJsonArrayOperator()), - (FunctionRenderingSupport) nodeBuilder.getQueryEngine().getSqmFunctionRegistry().findFunctionDescriptor(hibernateContext.getJsonFunctionJsonArrayOperator()), + (FunctionRenderer) nodeBuilder.getQueryEngine().getSqmFunctionRegistry().findFunctionDescriptor(hibernateContext.getJsonFunctionJsonArrayOperator()), arguments, null, null, diff --git a/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/predicates/AbstractJsonbArrayStringsExistPredicate.java b/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/predicates/AbstractJsonbArrayStringsExistPredicate.java index c9118b77..36facf73 100644 --- a/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/predicates/AbstractJsonbArrayStringsExistPredicate.java +++ b/hibernate6/src/main/java/com/github/starnowski/posjsonhelper/hibernate6/predicates/AbstractJsonbArrayStringsExistPredicate.java @@ -1,23 +1,23 @@ /** - * Posjsonhelper library is an open-source project that adds support of - * Hibernate query for https://www.postgresql.org/docs/10/functions-json.html) - * - * Copyright (C) 2023 Szymon Tarnowski - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * Posjsonhelper library is an open-source project that adds support of + * Hibernate query for https://www.postgresql.org/docs/10/functions-json.html) + *

+ * Copyright (C) 2023 Szymon Tarnowski + *

+ * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + *

+ * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + *

+ * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA */ package com.github.starnowski.posjsonhelper.hibernate6.predicates; @@ -25,7 +25,7 @@ import com.github.starnowski.posjsonhelper.hibernate6.JsonBExtractPath; import com.github.starnowski.posjsonhelper.hibernate6.operators.JsonArrayFunction; import org.hibernate.query.sqm.NodeBuilder; -import org.hibernate.query.sqm.function.FunctionRenderingSupport; +import org.hibernate.query.sqm.function.FunctionRenderer; import org.hibernate.query.sqm.function.SelfRenderingSqmFunction; import org.hibernate.query.sqm.produce.function.StandardFunctionReturnTypeResolvers; import org.hibernate.query.sqm.tree.SqmCopyContext; @@ -33,6 +33,7 @@ import org.hibernate.type.StandardBasicTypes; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -70,7 +71,7 @@ public AbstractJsonbArrayStringsExistPredicate(HibernateContext context, NodeBui public AbstractJsonbArrayStringsExistPredicate(HibernateContext context, NodeBuilder nodeBuilder, JsonBExtractPath jsonBExtractPath, JsonArrayFunction arrayFunction, String functionName) { super(nodeBuilder.getQueryEngine().getSqmFunctionRegistry().findFunctionDescriptor(functionName), - (FunctionRenderingSupport) nodeBuilder.getQueryEngine().getSqmFunctionRegistry().findFunctionDescriptor(functionName), + (FunctionRenderer) nodeBuilder.getQueryEngine().getSqmFunctionRegistry().findFunctionDescriptor(functionName), parameters(jsonBExtractPath, arrayFunction), null, null, @@ -94,7 +95,7 @@ private static JsonArrayFunction mapArrayValues(NodeBuilder nodeBuilder, Hiberna throw new IllegalArgumentException("Values can not be null or empty list"); } List> arrayArguments = new ArrayList<>(); - arrayArguments.addAll(Stream.of(values).map(p -> nodeBuilder.value(p)).collect(Collectors.toList())); + arrayArguments.addAll(Stream.of(values).map(p -> (SqmExpression)nodeBuilder.value(p)).collect(Collectors.toList())); JsonArrayFunction jsonArrayFunction = new JsonArrayFunction(nodeBuilder, arrayArguments, context); return jsonArrayFunction; } diff --git a/text/pom.xml b/text/pom.xml index b672ef0d..6e9ec00d 100644 --- a/text/pom.xml +++ b/text/pom.xml @@ -17,7 +17,7 @@ - 6.1.5.Final + 6.4.0.Final 11 11 11