HHH-16486 StandardTemporaryTableExporter generates queries with the wrong parameter marker

This commit is contained in:
Andrea Boriero 2023-10-06 15:25:13 +02:00 committed by Christian Beikov
parent b26e0494f3
commit 8e4ce4ea5c
1 changed files with 5 additions and 1 deletions

View File

@ -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<SharedSessionContractImplementor, String> 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();