Mar 4th, 2012, 02:13 PM
How to get Hibernate Session ?
I have a Spring MVC project where a dataSource is configured in the following files:
The dataSource seems to be set up correctly, since Hibernate creates the tables on Tomcat start-up.
In my previous Hibernate projects (which were not Spring-based) I used to have the famous HibernateUtil Class which I could get a Hibernate Session from, and do my database-related work.
Obviously HibernateUtil is not needed any more with Spring...
But how can I get the Session?
Edit: Or should I go for EntityManager? If yes, how can I get an instance?
Last edited by yglodt; Mar 4th, 2012 at 02:49 PM.
Mar 4th, 2012, 03:07 PM
I suggest the reference guide which explains this in quite some detail. you want to read the chapter about hibernate and especially the part about implementing plain hibernate daos.
Mar 4th, 2012, 04:29 PM
Thanks for the guidance!
I am currently reading http://static.springsource.org/sprin.../html/orm.html, chapter 13.3 seems to be what I need.
Tags for this Thread