Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 69EDDCF81 for ; Fri, 27 Jul 2012 07:31:11 +0000 (UTC) Received: (qmail 42021 invoked by uid 500); 27 Jul 2012 07:31:11 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 41987 invoked by uid 500); 27 Jul 2012 07:31:10 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 41478 invoked by uid 99); 27 Jul 2012 07:31:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jul 2012 07:31:09 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [208.78.103.231] (HELO vorsha.objectstyle.org) (208.78.103.231) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 27 Jul 2012 07:31:01 +0000 Received: (qmail 21339 invoked from network); 27 Jul 2012 07:30:38 -0000 Received: from unknown (HELO ?192.168.1.37?) (194.158.197.10) by vorsha.objectstyle.org with SMTP; 27 Jul 2012 07:30:38 -0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: ToManyList cannot be instantiated with a list.getClass().newInstance() From: Andrus Adamchik In-Reply-To: <5010F23E.7080904@telia.com> Date: Fri, 27 Jul 2012 10:30:37 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <044F6956-A21B-42E2-949A-34440C1108BD@objectstyle.org> References: <4FFE64A5.5030206@telia.com> <5010F23E.7080904@telia.com> To: user@cayenne.apache.org X-Mailer: Apple Mail (2.1084) Hi Tomas, > PS ! Have a look at the application at = http://blog.stenlund.cc/?page_id=3D26, a cross country skiing time = recording and competition management application using Apache Pivot and = Cayenne. It is a pleasure working with those two frameworks, among = other. DS! Nice! :) Andrus On Jul 26, 2012, at 10:31 AM, Tomas Stenlund wrote: > Hi Andrus, >=20 > thanks for taking your time to give your opinion. >=20 > Yes, I have come to the same conclusion as you. The TooMany list = outside cayenne don't really mean anything. Since Pivot is able to = swallow List:s right out of the box to display them in List-, = Tablewiddgets etc. I got led down the wrong alley. Looking into the = source of Pivot it actually does some manipulating with the List and = creation of new Lists that will not work with cayenne. I have also = discussed this with the guys at the Pivot list. >=20 > So, now I convert the Cayenne TooManyList to simple "Java lists" and = send them into Pivot instead. So when the Pivot dialogues want to change = some data in the CayenneObjects it goes through getters/setters I can = just then commit the changes after the user for instance press "Save". = So it works well. >=20 > Cheers, >=20 > Tomas >=20 > PS ! Have a look at the application at = http://blog.stenlund.cc/?page_id=3D26, a cross country skiing time = recording and competition management application using Apache Pivot and = Cayenne. It is a pleasure working with those two frameworks, among = other. DS! >=20 > On 07/23/2012 03:39 PM, Andrus Adamchik wrote: >> 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? >>=20 >> Cheers, >> Andrus >>=20 >>=20 >> On Jul 12, 2012, at 8:46 AM, Tomas Stenlund wrote: >>=20 >>> Hi, >>>=20 >>> 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. >>>=20 >>> 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. >>>=20 >>> 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. >>>=20 >>> Thanks for any comments, >>>=20 >>> Cheers, >>>=20 >>> Tomas >>>=20 >>=20 >=20