Hibernate : Session evict

In this tutorial we will discuss about session.evict() method.

Hibernate session.evict() :

The function of evict() method is used to remove instance from the session
cache. So for first time saving the object ,save object by calling
session.save(object) method
before evicting the object from the cache. In the same way update object by
calling session.saveOrUpdate(object)
or session.update(object) before calling evict().This operation cascades to
associated instances if the association is mapped with cascade="evict".