I see what you're saying now. You're right, the call to localObject()
doesn't copy the changes map for the object. Merely setting the
persistenceState to MODIFIED won't cause a database commit, nor will a
phantom change like setting an attribute to its current value. Cayenne
will efficiently see that there are no real changes and will generate no
SQL. I'd say the docs are a little misleading here... "you are
responsible for setting correct persistence state" suggests that
setPersistenceState() is a solution.
I see a comment in http://issues.apache.org/cayenne/browse/CAY-380:
"Current implementation still doesn't do a good job in merging data
into dirty objects, but it is a start. Will see how it pans out."
And there's this line in the source code:
// TODO: Andrus, 1/24/2006 implement smart merge for modified objects...
You could try entering a new issue in JIRA.
Jonathan Bélisle wrote:
> I printed the list of updated objects and my object is there with the
> persistance state to MODIFIED.
> And I am committing the right dataContext : dataContext2
>
> Event then, committing one or the other data context should write the
> changes to the database.
>
This archive was generated by hypermail 2.0.0 : Wed Aug 30 2006 - 09:46:39 EDT