hi all,
I want to evict a collection from Session catche. I tried with "session.evict()", but this only evicts an object from session and not collection object. I googled further to learn that collection always resides in 2nd level catche. Also to remove this we need to use, SessionFactory.evictCollection().
Here is my class
Code:
@Entity
public class Department
{
@Id
private int deptId;
private String deptName;
@OneToMany(fetch = fetchType.LAZY)
@JoinColumn(name="deptId")
private List<Employee> empList;
------
------
Getter and Setter
------
------
}
I want to evict employee collection. If I try to evict "empList " using
session.getSessionFactory().evictCollection("Department.empList", deptId);
where, deptId is some Department Id.
This throws exception like
"org.Hibernate.MappingException : unknown collection role : Department.empList".
Anybody, have any idea, why this is happening??