In our current application (Java SE), we use the Hibernate API, but we kind of want to switch to JPA, where it is possible (but slowly). To do this, I need an EntityManagerFactory instead of a SessionFactory (and I would like to leave this axiom without argument).
What is the problem: at present, our factory session is created from org.hibernate.cfg.Configuration , and I would like to keep it the same as now, because this configuration is transmitted through various parts of our software that can and do configure persistence by discretion.
So the question is: how can I do
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder() .applySettings( hibConfiguration.getProperties() ) .buildServiceRegistry(); SessionFactory sessionFactory = hibConfiguration.buildSessionFactory( serviceRegistry );
what leads to EntityManagerFactory ?
java hibernate jpa entitymanager sessionfactory
psychollek
source share