List of usage examples for org.hibernate.jpa HibernateEntityManagerFactory getSessionFactory
@Deprecated
default SessionFactoryImplementor getSessionFactory()
From source file:org.lazulite.boot.autoconfigure.core.repository.hibernate.HibernateUtils.java
License:Apache License
/** * ?jpa EntityManagerFactory ? hibernate SessionFactory API * * @param emf//from ww w . j a v a2 s. co m * @return */ public static SessionFactory getSessionFactory(EntityManagerFactory emf) { HibernateEntityManagerFactory hmf = emf.unwrap(HibernateEntityManagerFactory.class); return hmf.getSessionFactory(); }
From source file:org.meruvian.yama.service.jpa.hibernate.HibernateListenerConfigurer.java
License:Apache License
@PostConstruct public void init() { HibernateEntityManagerFactory f = (HibernateEntityManagerFactory) entityManagerFactory; SessionFactoryImpl sf = (SessionFactoryImpl) f.getSessionFactory(); EventListenerRegistry registry = sf.getServiceRegistry().getService(EventListenerRegistry.class); registry.getEventListenerGroup(EventType.PRE_INSERT).appendListener(logInformationListener); registry.getEventListenerGroup(EventType.PRE_UPDATE).appendListener(logInformationListener); }