CasaDelGato wrote:
Reading through that stuff again...
Okay, I'm guessing you mean I should set the hibernate.ejb.session_factory_observer property?
Hmm, that does look like it will do what I need. Hope it works.
Thanks.
Actually I was referring to the top of the section (manager1 below is replaced with the name of your persistence unit in persistence.xml):
Code:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("manager1");
If you really need access to the SessionFactory or Session after that you can use:
Code:
EntityManager em = emf.createEntityManager();
Session session = (Session)em.getDelegate();
SessionFactory sf = session.getSessionFactory();
But if you're using JPA, you should be using EntityManager and EntityManagerFactory.