Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Don't get programmatical cache invalidation to work [JPA]
icon9.gif  Don't get programmatical cache invalidation to work [JPA] [message #788063] Wed, 01 February 2012 05:03 Go to previous message
Marian Seitner is currently offline Marian Seitner
Messages: 4
Registered: October 2009
Junior Member
Hi,

my database is externally modified so at some point I need to invalidate the entity cache in my web application.

I wrote a servlet which basically does the following:

@PersistenceContext // injected via Spring
EntityManager em;

JpaEntityManager nativeEm = em.unwrap(JpaEntityManager.class);

// this method always throws an NPE
Session session = nativeEm.getSession();

session.getIdentityMapAccessor().invalidateAll();


I also tried the other flavors of get*Session(), but none of them worked. What is the correct way to get access to an active session?

Thanks,
Marian


Environment:

  • GlassFish 3.1.1 w/ EclipseLink 2.3.0
  • MySQL 5.x

 
Read Message icon9.gif
Read Message
Read Message
Previous Topic:Custom MetadataSource and Dynamic Weaving
Next Topic:Don't get programmatical cache invalidation to work [JPA]
Goto Forum:
  


Current Time: Sun May 19 08:16:11 EDT 2013

Powered by FUDForum. Page generated in 0.01679 seconds