Hi there,
I have problem. In my application, sometimes I have to modify
something in database from without my application (using independent
db connection like the one from [Runtime->Databases] in NetBeans).
When I do this, TopLink Essentials still does see old values because
of its cache.
The cure for that was supposed to be a special method of invalidating
TopLink cache, here is how I do it:
public void invalidateCache() {
IdentityMapAccessor identityMapAccessor = getIdentityMapAccessor();
identityMapAccessor.invalidateAll();
}
private IdentityMapAccessor getIdentityMapAccessor() {
oracle.toplink.essentials.ejb.cmp3.EntityManager toplinkEm =
(oracle.toplink.essentials.ejb.cmp3.EntityManager) em.getDelegate();
return toplinkEm.getActiveSession().getIdentityMapAccessor();
}
I have invalidateCache method in my UtilityServiceBean, and whan I
change something in database I call it - but it does not work. After
calling invalidateCache, TopLink still return data from cache, not
from application. The only thing that works is to restart Glassfish :/
What is wrong?
Regards,
Witold Szczerba