Don't get programmatical cache invalidation to work [JPA] [message #788067] |
Wed, 01 February 2012 05:03  |
Eclipse User |
|
|
|
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
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.16900 seconds