Search in sources :

Example 1 with CopyIdentifierComponentSecondPass

use of org.hibernate.cfg.CopyIdentifierComponentSecondPass in project hibernate-orm by hibernate.

the class InFlightMetadataCollectorImpl method topologicalSort.

/* naive O(n^3) topological sort */
private void topologicalSort(List<CopyIdentifierComponentSecondPass> sorted, Set<CopyIdentifierComponentSecondPass> toSort) {
    while (!toSort.isEmpty()) {
        CopyIdentifierComponentSecondPass independent = null;
        searchForIndependent: for (CopyIdentifierComponentSecondPass secondPass : toSort) {
            for (CopyIdentifierComponentSecondPass other : toSort) {
                if (secondPass.dependentUpon(other)) {
                    continue searchForIndependent;
                }
            }
            independent = secondPass;
            break;
        }
        if (independent == null) {
            throw new MappingException("cyclic dependency in derived identities");
        }
        toSort.remove(independent);
        sorted.add(independent);
    }
}
Also used : CopyIdentifierComponentSecondPass(org.hibernate.cfg.CopyIdentifierComponentSecondPass) DuplicateMappingException(org.hibernate.DuplicateMappingException) MappingException(org.hibernate.MappingException)

Aggregations

DuplicateMappingException (org.hibernate.DuplicateMappingException)1 MappingException (org.hibernate.MappingException)1 CopyIdentifierComponentSecondPass (org.hibernate.cfg.CopyIdentifierComponentSecondPass)1