[
https://issues.apache.org/jira/browse/OPENJPA-885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dianne Richards updated OPENJPA-885:
------------------------------------
Attachment: DetachStateCascadeTestPatch.txt
For the DetachState options, I think there needs to be a spec clarification in
section 3.2.6 (Evicting an Entity Instance from the Persistence Context)
regarding what to do about cascading and unloaded fields and associations.
After several of us have looked at the spec, we feel that section 3.2.7
(Detached Entities) implies that we should not load unloaded fields during
detach(). We will be asking for spec clarification on this. In the meantime,
we're proceeding with our assumption.
Thanks to Pinaki for the following illustration of this assumption:
Consider an entity y that is reachable from x, the root detached entity. What
happens to y when we call detach(x)?
Two determining factors :
is y loaded?
is y reachable via DEATCH cascade?
Let us call {D(x)} is the set of entities that are reachable from x after
detach(x) call. That is to say if I now serialize x and take that serialized
object x' to another remote tier the paths I can access from serialized x' is
designated by {D(x)}.
And here are the choices for y.
------------------------------------------------------------------------------------------------------------------
Loaded? DEATCH cascade? Effect of detach(x) on y
-------------------------------------------------------------------------------------------------------------------
1. yes yes -- y is in {D(x)} and y is removed from
persistence context
2. yes no -- y is in {D(x)} but y is not removed from
the persistence context (i.e. this is the impact of DEATCH cascade and OpenJPA
did not have that feature)
3. no yes -- y is not in {D(x)} and y was never in
persistence context (i.e. detach does not load additional state even when
DEATCH cascade is specified)
4. no no -- same as (3) above
--------------------------------------------------------------------------------------------------------------------
Now, to address the DetachState options. During the DetachManager preDetach()
method, the appropriate fields/associations are loaded based on the DetachState
option. Then, the detach processing occurs for those for the loaded
associations where the DETACH cascade is specified. The attached patch,
DetacheStateCascadeTestPatch.txt, tests these options and their relationship to
the table above.
> Support clear methods on EntityManager, including new CascadeType.CLEAR
> ------------------------------------------------------------------------
>
> Key: OPENJPA-885
> URL: https://issues.apache.org/jira/browse/OPENJPA-885
> Project: OpenJPA
> Issue Type: Sub-task
> Affects Versions: 2.0.0
> Reporter: Dianne Richards
> Assignee: Dianne Richards
> Fix For: 2.0.0
>
> Attachments: cascadeTestPatch.txt, CompatibilityProblemPatch.txt,
> detachCodePatch.txt, DetachStateCascadeTestPatch.txt, detachTestPatch.txt,
> patch.txt
>
>
> Support the 2.0 new EntityManager clear() methods. Also support the new
> CascadeType.CLEAR.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.