[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5762) Consider whether new ClassMetadata.getIdenifier(Object, SessionImplementor) is correct

Mike Q (JIRA) noreply at atlassian.com
Tue Nov 30 04:38:14 EST 2010


Consider whether new ClassMetadata.getIdenifier(Object, SessionImplementor) is correct
--------------------------------------------------------------------------------------

                 Key: HHH-5762
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5762
             Project: Hibernate Core
          Issue Type: Task
          Components: core
    Affects Versions: 3.6.0
            Reporter: Mike Q


I recently upgraded from 3.3.2 to 3.6.0.  On doing I noticed the ClassMetadata.getIdentifier(Object, EntityMode) interface method was deprecated and had been replaced by ClassMetadata.getIdentifier(Object, SessionImplementor).  This equally applies to setIdentifier and instantiate.

This was confusing because I was always under the impression that ClassMetadata is a public API to be used for introspection of the hibernate model and reflective manipulation of entities.  ie It might easily be used by application code.

Conversely I always thought that SessionImplementor was an internal API that I might interact with when writing my own EventListeners or UserTypes but general day to day use would never see this.

If my above impressions are correct then it seems wrong that a public API, ClassMetadata, has methods that require an internal/private API, SessionImplementor.  When working with the hibernate public API I have no way of getting a SessionImplementor other than "knowing" that I can cast a Session, but that will break if anything ever proxies a Session for some reason.

Anyways I would like someone to consider whether the above method changes are a good thing for the hibernate API.  From the PoV of someone who uses the ClassMetadata API a fair amount I would say they are not as I now have to make dangerous (casting) assumptions in my code.  But I don't know the full reasons for this change so I might be missing something.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list