cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: ClassCastException, Cayenne 2.0.4
Date Mon, 08 Sep 2008 08:29:07 GMT

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  

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.


View raw message