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