Fix QueryLiteral assertion error in table based multi-table insert handling

This commit is contained in:
Christian Beikov 2023-06-26 18:17:06 +02:00
parent acc6b2cdc4
commit 7d1058316a
1 changed files with 3 additions and 2 deletions

View File

@ -255,7 +255,7 @@ public class TableBasedInsertHandler implements InsertHandler {
final Optimizer optimizer = ( (OptimizableGenerator) generator ).getOptimizer();
if ( optimizer != null && optimizer.getIncrementSize() > 1 ) {
final TemporaryTableColumn rowNumberColumn = entityTable.getColumns()
.get( entityTable.getColumns().size() - 1 );
.get( entityTable.getColumns().size() - ( sessionUidColumn == null ? 1 : 2 ) );
rowNumberType = (BasicType<?>) rowNumberColumn.getJdbcMapping();
final ColumnReference columnReference = new ColumnReference(
(String) null,
@ -293,7 +293,8 @@ public class TableBasedInsertHandler implements InsertHandler {
if ( rowNumberType != null ) {
values.getExpressions().add(
new QueryLiteral<>(
i + 1,
rowNumberType.getJavaTypeDescriptor()
.wrap( i + 1, sessionFactory.getWrapperOptions() ),
rowNumberType
)
);