users@glassfish.java.net

GlassFish v2 Entity Cache problems

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

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