It is used to sync the DataBase data with the session.....
Student student = (Student) session.get(Student.class,"1");
System.out.println(".Student Name:"+ student.getStudentName());
//session.refresh(student);
System.out.println(".Student Name:"+ student.getStudentName());
If refresh is not in comment then we will get updated data otherwise old data.
Verify the console there will be 2 select queries...one is for get and the other is for refresh..to sync DataBase with the session then select is required...
note : in JDBC while committing the Transaction just it will apply commit,in hibernate if required then it execute update and commit....
Student student = (Student) session.get(Student.class,"1");
System.out.println(".Student Name:"+ student.getStudentName());
//session.refresh(student);
System.out.println(".Student Name:"+ student.getStudentName());
If refresh is not in comment then we will get updated data otherwise old data.
Verify the console there will be 2 select queries...one is for get and the other is for refresh..to sync DataBase with the session then select is required...
note : in JDBC while committing the Transaction just it will apply commit,in hibernate if required then it execute update and commit....