MyEclipse: How to create an instance of Session in Hibernate 2 ?
Ghazalawahid - Jul 20, 2006 - 06:47 PM
Post subject: How to create an instance of Session in Hibernate 2 ?
As in Hibernate 3, a session can be created by :
Session session = SessionManager.currentSession();
but in hibernate 2 ,this command is not working to create a session,so how to create a session in hibernate 2?
support-snpe - Jul 20, 2006 - 08:44 PM
Creating session is the same in hibernate 2 and hibernate 3. Hibernate 3 have added EntityManager, but it isn't part of hibernate (it is added product) and used for ejb3.
You have to use SessionFactory and MyEclipse can make SessionFactory utility class
You can see example making session factory when you add hibernate capabilities (or separate wizard in MyEclipse 5.0M2).
You can grab session with getCurrentSession method
philc - Jan 26, 2011 - 08:13 PM
Ok so I found the suggestion to add Hibernate capabilities to create a HibernateSessionFactory from an old forum post http://www.myeclipseide.com/PNphpBB2-printview-t-4948-start-0.html. Lets see how this goes.
All times are GMT - 6 Hours
Powered by PNphpBB2
© 2003-2004 The PNphpBB GroupCredits