Not familiar with Pivot, so not sure what its expectations are. But creating a ToManyList outside Cayenne generally doesn't seem like a good idea. Maybe what you doing as a workaround is perfectly valid. So what is the purpose of creating a new list by Pivot and what happens to that list after that? Is there an attempt to persist it afterwords?
Cheers, Andrus On Jul 12, 2012, at 8:46 AM, Tomas Stenlund wrote: > 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 >
