Persist : make a transient instance persistant, means save the object....its like save method,save returns identifier but persist return type is void...
Student student = new Student();
student.setStudentNo("1");
student.setStudentName("venu");
session.persist(student);
The problem with update is we need to set all the values otherwise it takes null values.
Student student = (Student)session.load(Student.class,"1");
student.setStudentName("venu - u");
//set only the required data(update data)..
tx.commit();
update is used to update a detatched object....
Student student = new Student();
student.setStudentNo("1");
student.setStudentName("venu");
session.persist(student);
The problem with update is we need to set all the values otherwise it takes null values.
Student student = (Student)session.load(Student.class,"1");
student.setStudentName("venu - u");
//set only the required data(update data)..
tx.commit();
update is used to update a detatched object....