-->
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.  [ 3 posts ] 
Author Message
 Post subject: How can I evict some entity from Cache using JPA + Hibernate
PostPosted: Sun Sep 30, 2007 3:25 pm 
Beginner
Beginner

Joined: Sun Sep 30, 2007 2:58 pm
Posts: 26
How can I evict some entity from 2nd Level Cache using JPA + Hibernate? Is there any method as below?

"For the second-level cache, there are methods defined on SessionFactory for evicting the cached state of an instance, entire class, collection instance or entire collection role.

sessionFactory.evict(Cat.class, catId); //evict a particular Cat
sessionFactory.evict(Cat.class); //evict all Cats
sessionFactory.evictCollection("Cat.kittens", catId); //evict a particular collection of kittens
sessionFactory.evictCollection("Cat.kittens"); //evict all kitten collections"

How can I do that using EntityManager or EntityManagerFactory?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 01, 2007 1:44 pm 
Beginner
Beginner

Joined: Sun Sep 30, 2007 2:58 pm
Posts: 26
http://forum.hibernate.org/viewtopic.php?p=2366024


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 19, 2007 4:03 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
( (HibernateEntityManagerFactory) emf).getSessionFactory()
and then the evict method you want

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.