ContactUs

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

What is clear method ?

It will remove all the objects from the session,means all persistance objects becomes detatched. Evict will change one persistance object to detatched,clear will change all the persistance objects to detatched.
clear method completely clears the session.Clears all loaded instances and cancel all pending saves,updates and deletions.
        Student student1 = (Student)session.get(Student.class,"1");
        Student student2 = (Student)session.get(Student.class,"2");
        //session.clear();
        student1.setStudentName("venu");
        student2.setStudentName("venu");
clear will remove both the objects(student1/2) from the session but evict can remove only one obj from the session. If clear is not in comment then it will not update the records because then that time its in detatched state.....if clear is in comment then student is in persistance state..then the data will be updated...
Related Posts Plugin for WordPress, Blogger...
Flag Counter