We can get JDBC Connection from Session.
Connection con = session.connection();
Note : JDBC Connection and Session both are not same because using Connection we cant store an object in the DataBase but using Session we can store an object in the DB.
Session internally contains the Connection object with Has-A relation....
1.Is-A
class A{}
class B extends A{}
2.Has-A
class B{
private A a;
}
we can give JDBC Connection to the session...
Session session = sFactory.openSession(con);
Connection con = session.connection();
Note : JDBC Connection and Session both are not same because using Connection we cant store an object in the DataBase but using Session we can store an object in the DB.
Session internally contains the Connection object with Has-A relation....
1.Is-A
class A{}
class B extends A{}
2.Has-A
class B{
private A a;
}
we can give JDBC Connection to the session...
Session session = sFactory.openSession(con);