persistence@glassfish.java.net

Re: caching bug?

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Thu, 09 Aug 2007 18:44:44 -0700

No, it's called non-managed relationships. You need to clean them up on all
sides (unless that particular side is responsible for cascade removal).

But yes, it's a side-effect of the caching.

thanks,
-marina

Jeffrey Blattman wrote:
> Jeffrey Blattman wrote:
>
>> i have entity A that has a collection of entities C
>>
>> /public class A ...
>> private List<C> cs = ...
>> /
>> so i do an em.remove(C.class, cid). now i want to verify that the C
>> with ID cid is removed. so i do:
>>
>> /C c = em.find(C.class, cid);
>> /
>> this returns null, as expected. now i do this ...
>>
> forgot to mention ... in the above find(), i see a select as expected ...
>
>> /A a = em.find(A.class, ...);
>> List<C> cs = a.getCs();
>> /
>
> but here i see no access to the DB.
>
>> and i page through the cs collection, i find that the C with ID cid
>> still exists. all of the above em.* operations are done in separate
>> transactions. is this a caching bug? i can provide a test case if
>> necessary.
>