openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Russell (JIRA)" <>
Subject [jira] Commented: (OPENJPA-453) Evicting embedded object nullifies statemanager
Date Thu, 28 May 2009 18:19:45 GMT


Craig Russell commented on OPENJPA-453:

It's probably useful to review the APIs and what they are intended for.

Evict is intended to clear the persistent values of an instance so that they can be cleanly
garbage collected. So all the persistent values are reset to their Java default values. This
reduces the number of references to other instances. But the internal reference to the persistence
context remains in the evicted instance. If the application wants to refresh the instances,
it can. 

Embedded instances have no identity so they cannot be used without their owners. When evicting
owners, the fields that reference the embedded instances are cleared so the embedded instances
are left floating. If the owner is subsequently refreshed, new embedded instances are created
from datastore values and attached to the owner.

Embedded instances behave mostly like transient instances with the small additional behavior
that they track changes made to themselves while owned. 

The JDO spec doesn't discuss the behavior of embedded instances with regard to evict or isXXX
methods. It doesn't discuss whether the instances themselves are persistent although they
have no persistent identity.

The attached test case doesn't demonstrate the NullPointerException, does it? If you can demonstrate
NPE, we can fix that.

There's a discussion on the mailing list that might be of interest to
folks here. The proposal is to treat embedded objects as transient for the purposes of life
cycle interrogatives and APIs. So isPersistent(embedded_instance) would return false just
like a transient instance.

Please see

> Evicting embedded object nullifies statemanager
> -----------------------------------------------
>                 Key: OPENJPA-453
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>         Environment: Kodo 4.1.4, Ms sql server 2005, jTDS 1.2, jdk 1.6
>            Reporter: Christiaan
>         Attachments:,
> I am noticing the following behaviour: If evict() is called on an embedded
> object the statemanager is nullified which is in contrast to non-embedded
> objects. Subsequently, calling JDOHelper.getPersistenceManager() on the
> evicted embedded object returns null. Is this the correct behaviour?

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message