At the risk of asking silly questions, why do you need the second
DataContext? If you do need the second one, could you wait until you
pull the object into the second context to do the setters? (So the
second context sets modified correctly.)
Your comment about Cayenne not thinking an object is modified is
correct. If you have:
if (object.getFirstName().equals("Michael"))
{
object.setFirstName("michael");
object.setFirstName("Michael");
}
You essentially haven't modified the object and Cayenne figures this out.
Thanks,
/dev/mrg
On 7/23/06, Jonathan Bélisle <[EMAIL PROTECTED]> wrote:
Hi, here is my problem.
I have a DataObject da1 registered with DataContext dc1.
I perform modification on da1. It's persistence state becomes MODIFIED.
Now I want to move da1 to DataContext dc2 and keep it's state MODIFIED
so that when I do dc2.commitChanges(); da1 get written to the database.
Using dc2.localObject(da1.getObjectId(), da1) doesn't work because it's
set the persistence state to COMMITTED and loose
track of witch properties were modified.
Even if I do da1.setPersistanceState(PersistenceState.MODIFIED) after
localObject() da1 does not get written to the database on the next
commit because dc2 thinks that no properties were modified.
Anybody know how to do that, a workaround ?
Thanks in advance, Jonathan.