Apache JDO Project - Re: RETRY: Transient instance referencing a detached instance? (was:

This is Interesting: Free IT Magazines  
Home > Archive > Apache JDO Project > October 2005 > Re: RETRY: Transient instance referencing a detached instance? (was:





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: RETRY: Transient instance referencing a detached instance? (was:
Craig L Russell

2005-10-20, 5:45 pm

Javadogs,

I've reviewed this material and agree with the general conclusion,
that we can add the ability to include detached objects in the
closure of instances for both makePersistent and attachCopy.

The spec as of today requires treating these three types of objects
in the closure differently:

persistent instances

attachCopy throws an exception; makePersistent ignores them

transient instances

attachCopy copies them and creates persistent-new instances;
makePersistent makes them persistent-new

detached instances

attachCopy copies them; makePersistent throws an exception

Here's the change as I would propose it:

persistent instances

attachCopy ignores them; makePersistent ignores them

transient instances

attachCopy copies them and creates persistent-new instances;
makePersistent makes them persistent-new

detached instances

attachCopy copies them; makePersistent copies them

If we make this change, the behavior of makePersistent and attachCopy
are more similar than today. The differences are in the treatment of
transient instances and whether or not the root objects are returned.
If we like, we can have makePersistent also return the root objects
by making a source-compatible change to the signatures of
makePersistent.

Craig

On Oct 5, 2005, at 11:59 AM, Matthew T. Adams wrote:

> "Wes Biggs" <wes@tralfamadore.com> wrote in message
> news:<mailman.5533.1128524276.10966.jdo-general@jdo-experts.org>...
>
> No, I'd like to continue to allow transient instances to be
> included in
> attachCopy graphs. I'd like to **add** the ability for detached
> objects to
> be included in makePersistent graphs.
>
> This use case fell out very naturally for me while working on a
> website that
> uses detached objects. I ended up with a transient User object
> referencing
> a detached Country object, and, of course, when I called
> pm.makePersistent(user), I got an JDOUserException as I should
> have, per the
> spec as it stands right now.
>
> --matthew
>
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com