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 bc00a8df20
commit 4ee3e400a4
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.dialect.Dialect;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.sql.ast.spi.ParameterMarkerStrategy;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
@ -101,8 +102,11 @@ public class StandardTemporaryTableExporter implements TemporaryTableExporter {
Function<SharedSessionContractImplementor, String> sessionUidAccess, Function<SharedSessionContractImplementor, String> sessionUidAccess,
SharedSessionContractImplementor session) { SharedSessionContractImplementor session) {
if ( idTable.getSessionUidColumn() != null ) { if ( idTable.getSessionUidColumn() != null ) {
final ParameterMarkerStrategy parameterMarkerStrategy = session.getSessionFactory()
.getFastSessionServices().parameterMarkerStrategy;
return getTruncateTableCommand() + " " + idTable.getQualifiedTableName() return getTruncateTableCommand() + " " + idTable.getQualifiedTableName()
+ " where " + idTable.getSessionUidColumn().getColumnName() + " = ?"; + " where " + idTable.getSessionUidColumn().getColumnName() + " = "
+ parameterMarkerStrategy.createMarker( 0, null );
} }
else { else {
return getTruncateTableCommand() + " " + idTable.getQualifiedTableName(); return getTruncateTableCommand() + " " + idTable.getQualifiedTableName();