Kevin,
could you please check in a unit test that shows this problem - I'll
take a look.
Andrus
On May 2, 2006, at 8:17 PM, Kevin Menard wrote:
Andrus, you'd probably be the best guy to answer this, but I'm
going to throw it out there in general. For reasons lost to me
now, with the old milestones, I'd have code like the following:
final Blah b = (Blah) dc.createAndRegister(Blah.class);
// Somewhere else.
dc.unregisterObjects(Collections.singletonList(b));
// Somewhere else.
b.setSomeRelation(yo);
yo is registered with the DC, so setting the relationship should
register b with the DC as well. I suspect I had the unregister
call because at one point there were problems with registering a DO
twice with the same DC.
Anyway, the above causes an exception. I've spent the better part
of the day tracking it down. It appears that when the insert
occurs, the ID recorded for yo is null (so, the exception is a not-
null constraint violation). Remove the unregisterObjects() call
and everything works dandy. The problem seems to be the first time
through all the ObjectDiffs get created fine. The second time
through, however, there is no ArcOperation created for the
relationship.
So, is this a bug in how I'm doing things or in how Cayenne is? At
this point, I'm going to remove the unregisterObjects() call, but
it seems to me that if setting relationships will auto-register, it
should set everything up identically.
Thanks,
Kevin