From aecfb8004bfacb7d9a5afbcb57c4000ee9ef9c79 Mon Sep 17 00:00:00 2001 From: lidongy <1879087903@qq.com> Date: Fri, 24 Feb 2023 14:23:42 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-90408=E3=80=90=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E3=80=91=E8=BF=81=E7=A7=BB=E3=80=81=E5=90=AF?= =?UTF-8?q?=E7=94=A8=E6=95=B0=E6=8D=AE=E5=BA=93=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InformationExtractorJdbcDatabaseMetaDataImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fine-hibernate/src/main/java/com/fr/third/org/hibernate/tool/schema/extract/internal/InformationExtractorJdbcDatabaseMetaDataImpl.java b/fine-hibernate/src/main/java/com/fr/third/org/hibernate/tool/schema/extract/internal/InformationExtractorJdbcDatabaseMetaDataImpl.java index 13c03a1ef..8a87089a2 100644 --- a/fine-hibernate/src/main/java/com/fr/third/org/hibernate/tool/schema/extract/internal/InformationExtractorJdbcDatabaseMetaDataImpl.java +++ b/fine-hibernate/src/main/java/com/fr/third/org/hibernate/tool/schema/extract/internal/InformationExtractorJdbcDatabaseMetaDataImpl.java @@ -650,11 +650,15 @@ public class InformationExtractorJdbcDatabaseMetaDataImpl implements Information final int columnPosition = resultSet.getInt( "KEY_SEQ" ); + final int index = columnPosition - 1; + // Fill up the array list with nulls up to the desired index, because some JDBC drivers don't return results ordered by column position + while ( pkColumns.size() <= index ) { + pkColumns.add( null ); + } final Identifier columnIdentifier = DatabaseIdentifier.toIdentifier( resultSet.getString( "COLUMN_NAME" ) ); - final ColumnInformation column = tableInformation.getColumn( columnIdentifier ); - pkColumns.add( columnPosition-1, column ); + pkColumns.set( index, tableInformation.getColumn( columnIdentifier ) ); } } finally {