in core/src/main/java/org/hibernate/ogm/hibernatecore/impl/OgmSessionFactoryImpl.java [165:195]
public <T> T unwrap(Class<T> type) {
if ( type.isAssignableFrom( SessionFactory.class ) ) {
return type.cast( this );
}
if ( type.isAssignableFrom( SessionFactoryImplementor.class ) ) {
return type.cast( this );
}
if ( type.isAssignableFrom( SessionFactoryImpl.class ) ) {
return type.cast( this );
}
if ( type.isAssignableFrom( OgmSessionFactory.class ) ) {
return type.cast( this );
}
if ( type.isAssignableFrom( OgmSessionFactoryImplementor.class ) ) {
return type.cast( this );
}
if ( type.isAssignableFrom( OgmSessionFactoryImpl.class ) ) {
return type.cast( this );
}
if ( type.isAssignableFrom( EntityManagerFactory.class ) ) {
return type.cast( this );
}
throw new PersistenceException( "Hibernate cannot unwrap EntityManagerFactory as '" + type.getName() + "'" );
}