Hey all,
I just spent the last few hours debugging this webapp of mine. Since
it's using Tapestry 4, I thought I had messed up some of the persistence
stuff or something. Instead, I came across something in Cayenne that
just doesn't seem right.
If a DO gets registered with a DC twice, it'll attempt to commit twice.
Since it is the same exact object however, only one PK will be
generated, which causes the commit to fail. Now, I'd certainly agree
that you probably shouldn't try to register twice, but in my case, the
first registration actually came from setting an already committed
object as relationship parameter. Cayenne is able to auto-register the
DO that the relationship value is being set on and it does so
transparently, which is cool. However, its side effects are not
transparent.
My guess is that DataContext#registerNewObject() should consult its
object store before calling registerNewObjectWithEntity(), or the latter
should perform the check. Or maybe the ObjectStore should use a HashSet
rather than an ArrayList. I really don't know, but like I said, it
should be transparent.
Am I correct in this assessment? It is getting rather late here, so I
may just be delusional . . .
-- Kevin
This archive was generated by hypermail 2.0.0 : Fri Jul 08 2005 - 01:39:51 EDT