Now I think I know where the problem is, the type checking in the
setList is not precise enough, both (DbPersonAddress and DbAddress)
extend a CayenneDataObject and implement Address, so are treated the
same. I need to put some more precise checking on the elements to
ensure setList does the right thing.
Ian
On 8 Sep 2008, at 09:29, Andrus Adamchik wrote:
>
> On Sep 8, 2008, at 11:18 AM, Ian Boston wrote:
>
>> Fantastic, thank you.
>>
>> One last question:
>> is this because Cayenne does introspection on the methods of the
>> Db entity class ?
>>
>> Since setAddresses is part of the Person API, (so I cant change
>> it) I assume that changing the name of the underlying attribute
>> will also fix this ?
>>
>> Ian
>
> Not sure I understand the question. So I maybe answering something
> you already know. What happens is that DbPerson.setAddresses(..)
> calls BaseCayenneShindigData.setList(..) method which in turn
> calls. 'Cayenne.DataObject.addToManyTarget("addresses", Address).
> 'addToManyTarget' is a generic method so it doesn't do any type
> checking, letting Address slip through where DbPersonAddress object
> is expected.
>
> So I guess when you are creating the test data, you need to create
> Address objects as well as DbPersonAddress objects explicitly and
> connect DbPersonAddress objects with DBPerson.
>
> Andrus
This archive was generated by hypermail 2.0.0 : Mon Sep 08 2008 - 05:30:59 EDT