title: Where can I get the map of PersistentClass objects that was under org.hibernate.cfg.Configuration in Hibernate 5?
body: <p>In Hibernate 3, in the <strong>org.hibernate.cfg.Configuration</strong> class there is a <strong>Map classes</strong> property that contains objects of type <strong>org.hibernate.mapping.PersistentClass</strong>.</p>
  
  <p>In a Grails application (which uses hibernate underneath the covers) I was extending a class that was extending the org.hibernate.cfg.Configuration. This allowed me to tap into the Map classes and do as follows:</p>
  
  <pre><code>for(PersistentClass pc : classes.values()) {
     for(Iterator iterator = pc.getTable().getForeignKeyIterator(); iterator.hasNext(); ) {
         ForeignKey fk = (ForeignKey) iterator.next();               
         iterator.remove();      
   }
  }
  </code></pre>
  
  <p>Basically, I am removing the foreign keys to certain 3rd party tables.</p>
  
  <p>I want to upgrade to Hibernate 5 but the new Configuration class does not have the Map classes that I depend on. </p>
  
  <ol>
  <li><p>How do I get the map of PersistentClass objects so that I can continue to remove their foreign key?</p></li>
  <li><p>If it is not supposed to be done through the Configuration anymore, how do I get access to the persistent objects? Through what class?</p></li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/lSuUW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lSuUW.png" alt="enter image description here"></a></p>
  
  <p>Please help. I am stuck.</p>