title: Why was hibernate's ClassMetadata.getIdentifier(Object, EntityMode) deprecated
body: <p>Just upgraded to hibernate 3.6.0 and found that this method is deprecated.</p>
  
  <pre><code>public Serializable getIdentifier(Object object, EntityMode entityMode) throws HibernateException;
  </code></pre>
  
  <p>It has been 'replaced' by this</p>
  
  <pre><code>public Serializable getIdentifier(Object entity, SessionImplementor session);
  </code></pre>
  
  <p>I'm not sure why this has been done, and more importantly, I don't believe the new method is a suitable replacement.</p>
  
  <p>I have code which binds hibernate objects/properties by using this API to create hibernate objects from XML (attributes->properties etc) and some other bits and pieces too.</p>
  
  <p>I have always considered ClassMetadata to be a public API that is to be used for this purpose.  And I have  been aware that SessionImplementor is an internal API that is not for use be application code.</p>
  
  <p>Assuming I am correct in the above two assertions it seems wrong that a public API requires a private API as a parameter?</p>
  
  <p>Does anyone know why this was done and how I should be approaching doing programmatic hibernate object access in the future?</p>
  
  <p>(Interestingly the getting/setting property value methods still take an EntityMode.)</p>