|
65 | 65 | import org.jboss.logging.Logger; |
66 | 66 |
|
67 | 67 | import static java.util.Collections.emptyMap; |
| 68 | +import static org.hibernate.internal.util.collections.ArrayHelper.reverseFirst; |
68 | 69 | import static org.hibernate.internal.util.collections.ArrayHelper.to2DStringArray; |
69 | 70 | import static org.hibernate.internal.util.collections.ArrayHelper.toIntArray; |
70 | 71 | import static org.hibernate.internal.util.collections.ArrayHelper.toStringArray; |
@@ -341,12 +342,12 @@ public JoinedSubclassEntityPersister( |
341 | 342 | // the first table as it will the driving table. |
342 | 343 | // tableNames -> CLIENT, PERSON |
343 | 344 |
|
344 | | - this.tableNames = reverse( naturalOrderTableNames, coreTableSpan ); |
345 | | - tableKeyColumns = reverse( naturalOrderTableKeyColumns, coreTableSpan ); |
346 | | - tableKeyColumnReaders = reverse( naturalOrderTableKeyColumnReaders, coreTableSpan ); |
347 | | - tableKeyColumnReaderTemplates = reverse( naturalOrderTableKeyColumnReaderTemplates, coreTableSpan ); |
348 | | - subclassTableNameClosure = reverse( naturalOrderSubclassTableNameClosure, coreTableSpan ); |
349 | | - subclassTableKeyColumnClosure = reverse( naturalOrderSubclassTableKeyColumnClosure, coreTableSpan ); |
| 345 | + this.tableNames = reverseFirst( naturalOrderTableNames, coreTableSpan ); |
| 346 | + tableKeyColumns = reverseFirst( naturalOrderTableKeyColumns, coreTableSpan ); |
| 347 | + tableKeyColumnReaders = reverseFirst( naturalOrderTableKeyColumnReaders, coreTableSpan ); |
| 348 | + tableKeyColumnReaderTemplates = reverseFirst( naturalOrderTableKeyColumnReaderTemplates, coreTableSpan ); |
| 349 | + subclassTableNameClosure = reverseFirst( naturalOrderSubclassTableNameClosure, coreTableSpan ); |
| 350 | + subclassTableKeyColumnClosure = reverseFirst( naturalOrderSubclassTableKeyColumnClosure, coreTableSpan ); |
350 | 351 |
|
351 | 352 | spaces = ArrayHelper.join( this.tableNames, toStringArray( persistentClass.getSynchronizedTables() ) ); |
352 | 353 |
|
@@ -800,46 +801,6 @@ public boolean isPropertyOfTable(int property, int j) { |
800 | 801 | return naturalOrderPropertyTableNumbers[property] == j; |
801 | 802 | } |
802 | 803 |
|
803 | | - /** |
804 | | - * Reverse the first n elements of the incoming array |
805 | | - * |
806 | | - * @return New array with the first n elements in reversed order |
807 | | - */ |
808 | | - private static String[] reverse(String[] objects, int n) { |
809 | | - |
810 | | - int size = objects.length; |
811 | | - String[] temp = new String[size]; |
812 | | - |
813 | | - for ( int i = 0; i < n; i++ ) { |
814 | | - temp[i] = objects[n - i - 1]; |
815 | | - } |
816 | | - |
817 | | - for ( int i = n; i < size; i++ ) { |
818 | | - temp[i] = objects[i]; |
819 | | - } |
820 | | - |
821 | | - return temp; |
822 | | - } |
823 | | - |
824 | | - /** |
825 | | - * Reverse the first n elements of the incoming array |
826 | | - * |
827 | | - * @return New array with the first n elements in reversed order |
828 | | - */ |
829 | | - private static String[][] reverse(String[][] objects, int n) { |
830 | | - int size = objects.length; |
831 | | - String[][] temp = new String[size][]; |
832 | | - for ( int i = 0; i < n; i++ ) { |
833 | | - temp[i] = objects[n - i - 1]; |
834 | | - } |
835 | | - |
836 | | - for ( int i = n; i < size; i++ ) { |
837 | | - temp[i] = objects[i]; |
838 | | - } |
839 | | - |
840 | | - return temp; |
841 | | - } |
842 | | - |
843 | 804 | @Override |
844 | 805 | public String getTableName() { |
845 | 806 | return tableNames[0]; |
|
0 commit comments