Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Cache.evict() after persist, or how?

Hello to the community!

My question would be the following: I have 2 entites (Many-to-one) When I make a new entity on the left side of the relation and setting the id for the other side (e.g.: user.setGroupId(..);) and persisting this new entity, everything looks fine. But I've realized that EclipseLink caches this entity and when I'm querying all of the entities from this table (e.g.: SELECT u FROM User u) with a JOIN FETCH hint for Group i'm getting null for user.getGroup(); but not for user.getGroupId(); for this newly inserted user. How can I make EclipseLink to forget that I've didn't set the group attribute but the groupId, and ask it to fetch the group entity aswell?
(If I'm adding @Cache(type = CacheType.NONE) then it's working, but I do want to use cache, but not for newly inserted entites)
What am I doing wrong? Thanks!

-- 
Regards,
Bálint Kriván

Back to the top