-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Evicting collection from 2nd level catche
PostPosted: Fri May 22, 2009 11:07 am 
Newbie

Joined: Thu May 14, 2009 10:34 am
Posts: 11
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??


Top
 Profile  
 
 Post subject: Re: Evicting collection from 2nd level catche
PostPosted: Mon Dec 09, 2013 4:45 am 
Newbie

Joined: Wed Oct 17, 2012 7:40 am
Posts: 3
Are you sure "Department" is a fully qualified class name? Ie. are you sure the class does not have any package at all?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.