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 :
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 Post subject:
Ghazalawahid ,
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