Steps to use hibernate into an application
1. Load the Hibernate Into Configuration File: -
Configuration conf = new Configuration ();
Conf. Configure (“anyname.cfg.xml”);
2. Parse The Loaded Xml And Generate SessionFactory: -
SessionFactory factory = conf. buildSessionFactory ();
3. Open a Session from SessionFactory: -
It internally opens a connection
Session ses = factory. openSession ()
4. Start a Transaction: -
Transaction tx= ses. beginTransaction ();
5. Do the persistency operations required
6. Commit or Rollback the Transaction: -
tx. Commit () / tx. Rollback ();
7. Close the Session: -
ses.close ()
Yep.... I couldn't have said it better myself......