From 4ee3e400a4a0ca36890c2ae792df8af114b6c6f7 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Fri, 6 Oct 2023 15:25:13 +0200 Subject: [PATCH] HHH-16486 StandardTemporaryTableExporter generates queries with the wrong parameter marker --- .../dialect/temptable/StandardTemporaryTableExporter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/temptable/StandardTemporaryTableExporter.java b/hibernate-core/src/main/java/org/hibernate/dialect/temptable/StandardTemporaryTableExporter.java index 35fa978da5..fea92f3426 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/temptable/StandardTemporaryTableExporter.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/temptable/StandardTemporaryTableExporter.java @@ -10,6 +10,7 @@ import java.util.function.Function; import org.hibernate.dialect.Dialect; import org.hibernate.engine.spi.SharedSessionContractImplementor; +import org.hibernate.sql.ast.spi.ParameterMarkerStrategy; /** * @author Steve Ebersole @@ -101,8 +102,11 @@ public class StandardTemporaryTableExporter implements TemporaryTableExporter { Function sessionUidAccess, SharedSessionContractImplementor session) { if ( idTable.getSessionUidColumn() != null ) { + final ParameterMarkerStrategy parameterMarkerStrategy = session.getSessionFactory() + .getFastSessionServices().parameterMarkerStrategy; return getTruncateTableCommand() + " " + idTable.getQualifiedTableName() - + " where " + idTable.getSessionUidColumn().getColumnName() + " = ?"; + + " where " + idTable.getSessionUidColumn().getColumnName() + " = " + + parameterMarkerStrategy.createMarker( 0, null ); } else { return getTruncateTableCommand() + " " + idTable.getQualifiedTableName();