users@glassfish.java.net

Re: GlassFish v2 Entity Cache problems

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Tue, 24 Jun 2008 09:37:28 -0400

Are you setting both sides of the relationship when creating the new
children objects?
--Gordon

Markus Karg wrote:
> I am using GFv2 and have problems with the entity cache.
>
> In one stateful session bean I am creating new child objects and store
> them in the DB using em.perists(myNewObject).
>
> In another stateful session bean I am doing em.find(...).getChildren()
> to load the new children.
>
> While I can see the new objects in the database table, .getChildren()
> returns NO (!) objects! Strange!
>
> I tried closing and restarting the ACC-driven client -- no improvement.
>
> I have to shutdown GFv2 and reboot it. When now doing
> em.find(...).getNewObjects(), the objects are correctly returned. I can
> reproduce ALWAYS.
>
> For me, it looks like GFv2 internally is not correctly marking its cache
> as dirty and just returns old stuff instead of reloading from the
> database when a new transactions starts.
>
> Why are the new objects not loaded when doing
> em.find(...).getChildren()?
>
> Is that a bug or is that wanted by the JPA specification?
>
> Do I always have to use "em.refresh(parentObject)" do get the new
> children?
>
> Thanks
> Markus
>
>
>
>