db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Schulze <ma...@jfire.org>
Subject Make dirty of detached objects?
Date Sat, 29 Dec 2007 23:39:17 GMT
Hello *,

I've a problem with replicating JDO objects from one datastore to another.
I detach the object from datastore A and attach it to datastore B. Since
no field was changed, the data in datastore B is not updated.

So I wanted to use JDOHelper.makeDirty(...), but unfortunately, it doesn't
show any effect. Hence, I read in the spec about "make dirty" and saw that
chapter 7.2 (page 77) states:

  "This method returns with no effect if the instance is not managed by a
  StateManager."

This makes sense for real transient objects, but IMHO not for detached
ones, because:

1st: Detached objects are able to track changes just like persistent
objects are. So it should technically be no problem to provide API
(=> JDOHelper.makeDirty(...)) for making a field dirty.

2nd: The "array problem", for which the "makeDirty(...)" method has been
created (if I understand the reasoning correctly) exists with detached
objects as well. It is therefore intuitive that the solution for the
"array problem" is the same for detached as for persistent objects.

Therefore, I'd like to kindly ask for a spec change:

JDOHelper.makeDirty(...) and the corresponding
PersistenceCapable.jdoMakeDirty(...) should work with detached objects
as well.

Additionally, I'd like to suggest a new feature: Every datastore should
have a unique identifier and a detached object should know from which
datastore it has been detached. Hence, when attaching it, the JDO
implementation could check whether the datastore is the same and if it
is not, treat every field as dirty.

And finally, I'd like to know why there is only
JDOHelper.isDirty(Object), but no way to find out which field it is.
This is currently not important to me, but I'd find it more
straight-forward, if makeDirty and isDirty were corresponding (i.e.
provided the same granularity).

Best regards and a HAPPY NEW YEAR!!!

Marco Schulze
JFire.org
NightLabs GmbH

Mime
View raw message