This thread has been locked & this forum has been archived.
Please post new topics to Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Author Message
Ghazalawahid
Veteran Member
Veteran Member


Joined: Dec 30, 2005
Posts: 42

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?
 
 View user's profile Send private message  
Reply with quote Back to top
support-snpe
Moderator
Moderator


Joined: Feb 03, 2006
Posts: 1117

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

Best regards
 
 View user's profile Send private message  
Reply with quote Back to top
philc
Veteran Member
Veteran Member


Joined: Dec 11, 2003
Posts: 9

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.
 
 View user's profile Send private message  
Reply with quote Back to top
All times are GMT - 6 Hours
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
® 2014 - Genuitec, LLC.