users@glassfish.java.net

RE: Re: GlassFish v2 Entity Cache problems

From: Markus Karg <karg_at_quipsy.de>
Date: Tue, 24 Jun 2008 15:44:12 +0200

No, I just did:

em.persist(new ChildObject(parent))

since this is the end of the transaction (parent is not further used by
my session) and I expected that GFv2 is doing a refresh of the parent at
the start of the next transaction anyways (third party could have
changed the database before that new transaction, so a refresh is
mandatory).

What is my fault?

Thanks
Markus

-----Original Message-----
From: Gordon Yorke [mailto:gordon.yorke_at_oracle.com]
Sent: Dienstag, 24. Juni 2008 15:37
To: users_at_glassfish.dev.java.net
Subject: Re: GlassFish v2 Entity Cache problems

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
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: users-help_at_glassfish.dev.java.net