[hibernate-dev] EntityManagetFactory unwrap - HHH-9665

Hardy Ferentschik hardy at hibernate.org
Fri Apr 24 14:53:16 EDT 2015


Hi there,

Steve and I are having a discussion around the intended behavior of EntityManagerFactory#unwrap.
See also HHH-9665[1] and the corresponding pull request [2].

At the moment the implementation in EntityManagerFactoryImpl allows to unwrap into the implementation
class itself. This way the user gets a reference to an internal class. IMO there should be instead a 
public interface which the user can unwrap to, eg HibernateEntityManagerFactory. This interface hosts 
additional methods we want to expose on top of the HibernateEntityManagerFactory. The unwrapping to 
should be disallowed (by expception) in this case. IMO this is just a continuation of the whole
idea of splitting packages between public, spi and internal. Of course this cannot stop a user from
doing an explicit cast, but that's a different story imo.

Steve and I have different take on this issue, so we where wondering what others think?

--Hardy

[1] https://hibernate.atlassian.net/browse/HHH-9665
[2] https://github.com/hibernate/hibernate-orm/pull/911
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 496 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/hibernate-dev/attachments/20150424/3f5404f7/attachment.bin 


More information about the hibernate-dev mailing list