5757import org .hibernate .boot .spi .NaturalIdUniqueKeyBinder ;
5858import org .hibernate .cfg .AnnotatedClassType ;
5959import org .hibernate .cfg .AvailableSettings ;
60- import org .hibernate .cfg .CopyIdentifierComponentSecondPass ;
6160import org .hibernate .cfg .CreateKeySecondPass ;
6261import org .hibernate .cfg .FkSecondPass ;
6362import org .hibernate .cfg .IdGeneratorResolverSecondPass ;
@@ -1504,7 +1503,6 @@ public Join locateJoin(Identifier tableName) {
15041503
15051504 private ArrayList <IdGeneratorResolverSecondPass > idGeneratorResolverSecondPassList ;
15061505 private ArrayList <SetSimpleValueTypeSecondPass > setSimpleValueTypeSecondPassList ;
1507- private ArrayList <CopyIdentifierComponentSecondPass > copyIdentifierComponentSecondPasList ;
15081506 private ArrayList <FkSecondPass > fkSecondPassList ;
15091507 private ArrayList <CreateKeySecondPass > createKeySecondPasList ;
15101508 private ArrayList <SecondaryTableSecondPass > secondaryTableSecondPassList ;
@@ -1526,9 +1524,6 @@ public void addSecondPass(SecondPass secondPass, boolean onTopOfTheQueue) {
15261524 else if ( secondPass instanceof SetSimpleValueTypeSecondPass ) {
15271525 addSetSimpleValueTypeSecondPass ( (SetSimpleValueTypeSecondPass ) secondPass , onTopOfTheQueue );
15281526 }
1529- else if ( secondPass instanceof CopyIdentifierComponentSecondPass ) {
1530- addCopyIdentifierComponentSecondPass ( (CopyIdentifierComponentSecondPass ) secondPass , onTopOfTheQueue );
1531- }
15321527 else if ( secondPass instanceof FkSecondPass ) {
15331528 addFkSecondPass ( (FkSecondPass ) secondPass , onTopOfTheQueue );
15341529 }
@@ -1576,15 +1571,6 @@ private void addIdGeneratorResolverSecondPass(IdGeneratorResolverSecondPass seco
15761571 addSecondPass ( secondPass , idGeneratorResolverSecondPassList , onTopOfTheQueue );
15771572 }
15781573
1579- private void addCopyIdentifierComponentSecondPass (
1580- CopyIdentifierComponentSecondPass secondPass ,
1581- boolean onTopOfTheQueue ) {
1582- if ( copyIdentifierComponentSecondPasList == null ) {
1583- copyIdentifierComponentSecondPasList = new ArrayList <>();
1584- }
1585- addSecondPass ( secondPass , copyIdentifierComponentSecondPasList , onTopOfTheQueue );
1586- }
1587-
15881574 private void addFkSecondPass (FkSecondPass secondPass , boolean onTopOfTheQueue ) {
15891575 if ( fkSecondPassList == null ) {
15901576 fkSecondPassList = new ArrayList <>();
@@ -1635,8 +1621,6 @@ public void processSecondPasses(MetadataBuildingContext buildingContext) {
16351621 processSecondPasses ( implicitColumnNamingSecondPassList );
16361622 processSecondPasses ( setSimpleValueTypeSecondPassList );
16371623
1638- processCopyIdentifierSecondPassesInOrder ();
1639-
16401624 processFkSecondPassesInOrder ();
16411625
16421626 processSecondPasses ( createKeySecondPasList );
@@ -1661,14 +1645,6 @@ public void processSecondPasses(MetadataBuildingContext buildingContext) {
16611645 }
16621646 }
16631647
1664- private void processCopyIdentifierSecondPassesInOrder () {
1665- if ( copyIdentifierComponentSecondPasList == null ) {
1666- return ;
1667- }
1668- sortCopyIdentifierComponentSecondPasses ();
1669- processSecondPasses ( copyIdentifierComponentSecondPasList );
1670- }
1671-
16721648 private void processSecondPasses (ArrayList <? extends SecondPass > secondPasses ) {
16731649 if ( secondPasses == null ) {
16741650 return ;
@@ -1681,39 +1657,6 @@ private void processSecondPasses(ArrayList<? extends SecondPass> secondPasses) {
16811657 secondPasses .clear ();
16821658 }
16831659
1684- private void sortCopyIdentifierComponentSecondPasses () {
1685-
1686- ArrayList <CopyIdentifierComponentSecondPass > sorted =
1687- new ArrayList <>( copyIdentifierComponentSecondPasList .size () );
1688- Set <CopyIdentifierComponentSecondPass > toSort = new HashSet <>( copyIdentifierComponentSecondPasList );
1689- topologicalSort ( sorted , toSort );
1690- copyIdentifierComponentSecondPasList = sorted ;
1691- }
1692-
1693- /* naive O(n^3) topological sort */
1694- private void topologicalSort ( List <CopyIdentifierComponentSecondPass > sorted , Set <CopyIdentifierComponentSecondPass > toSort ) {
1695- while (!toSort .isEmpty ()) {
1696- CopyIdentifierComponentSecondPass independent = null ;
1697-
1698- searchForIndependent :
1699- for ( CopyIdentifierComponentSecondPass secondPass : toSort ) {
1700- for ( CopyIdentifierComponentSecondPass other : toSort ) {
1701- if (secondPass .dependentUpon ( other )) {
1702- continue searchForIndependent ;
1703- }
1704- }
1705- independent = secondPass ;
1706- break ;
1707- }
1708- if (independent == null ) {
1709- throw new MappingException ( "cyclic dependency in derived identities" );
1710- }
1711- toSort .remove ( independent );
1712- sorted .add ( independent );
1713- }
1714- }
1715-
1716-
17171660 private void processFkSecondPassesInOrder () {
17181661 if ( fkSecondPassList == null || fkSecondPassList .isEmpty () ) {
17191662 return ;
0 commit comments