MyEclipse Forums
This thread has been locked & this forum has been archived.
Please post new topics to Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Ghazalawahid
Post subject: How to create an instance of Session in Hibernate 2 ?  PostPosted: Jul 20, 2006 - 06:47 PM
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
Post subject:   PostPosted: Jul 20, 2006 - 08:44 PM
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
Post subject:   PostPosted: Jan 26, 2011 - 08:13 PM
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
Display posts from previous:     
Jump to:  
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.
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits