diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/PrimaryKey.java b/hibernate-core/src/main/java/org/hibernate/mapping/PrimaryKey.java index dd2105e439..9fd2d00585 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/PrimaryKey.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/PrimaryKey.java @@ -118,7 +118,7 @@ public class PrimaryKey extends Constraint { final List columns = getColumns(); final Column[] columnsInOriginalOrder = new Column[columns.size()]; for ( int i = 0; i < columnsInOriginalOrder.length; i++ ) { - columnsInOriginalOrder[i] = columns.get( originalOrder[i] ); + columnsInOriginalOrder[originalOrder[i]] = columns.get( i ); } return Arrays.asList( columnsInOriginalOrder ); }