cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomas Stenlund <tomas.stenl...@telia.com>
Subject ToManyList cannot be instantiated with a list.getClass().newInstance()
Date Thu, 12 Jul 2012 05:46:13 GMT
Hi,

I'm using Cayenne 3.1B1 and Pivot 2.0.2 as a GUI and have come across 
something which I would gladly have some good suggestions around.

The automatically generated getters for the relationships sometimes 
returns a ToManyList of objects. To be able to use that list directly in 
Pivot:s widgets I have to wrap it with a ListAdapter. So, now for the 
cayenne questions, it seems that ToManyList does not have an empty 
constructor (maybe it does not have one because it does not really mean 
anything in the ToMany relationship) causing a call to the 
list.getClass().newInstance() that the ListAdapter in pivot does to 
create a new empty list of the same type to throw the 
InstantiationException.

It might be that the ListAdapter is wrongly implemented to assume that 
the List:s always have an empty constructor or something else. Any ideas 
? For now I just create a new list (ArrayList or something similar) and 
fills it up with the objects in the ToManyList to send it into Pivot to 
make it work, but it does seem to give an ugly solution moving from one 
list type to another just to come around this.

Thanks for any comments,

Cheers,

Tomas

Mime
View raw message