ContactUs

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

What is persist method ?

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....
Related Posts Plugin for WordPress, Blogger...
Flag Counter