clear(), evict() and close() methods in Hibernate

clear():  Completely clear the session and is used to dissociate/disconnect all the objects from the session.

Example on clear() Database table before execution


Database table after execution

 After calling session.clear(), emp1 and emp2 objects are disconnected from the session object. i.e emp1 and emp2 objects are moved from persistent state to detached […]