users@glassfish.java.net

Re: Strange JPA cache leakage with embedded Glassfish?

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Wed, 28 Sep 2011 07:53:46 -0400

On Wed, Sep 28, 2011 at 12:28 AM, Marina Vatkina
<marina.vatkina_at_oracle.com>wrote:

> Why wouldn't it be invalidated when EMF is closed by the container?
>

It probably is. The problem is that (contrary to my earlier assumption) the
container actually sticks around between test method invocations.

So the revised workflow is:

Create test case
Create (or reattach to) database
Create container
For each test method:
  clean test database
  ensure test database tables exist and are valid
  populate test database
  run test
Shut down container
Shut down database

The session cache therefore persists between test method invocations.

Thanks,
Laird

-- 
http://about.me/lairdnelson