Hi All, I am little confuse with hibernate and spring configuration, if I am using hibernate 4 and spring 3, the best way is using LocalContainerEntityManagerFactoryBean and HibernateJpaVendorAdapter, but my doubt is what about session factory? how JPA ara been managed?is this more perfomant than using SessionFactory?
The other question is, in my DAOs, should I inject an @PersistenceContext EntityManager?
Another question is, how connections are opened and closed? for example if I have:
entityManager.createQuery("Select model from person model where personid = ersonid").getSingleResult();
is this statement opening a closing a connection? then the JPA entity is store into the hiberante session??
I will be more than grateful if you help me with that.
Thanks in advance.
|