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