Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 18493 invoked from network); 26 Mar 2008 23:09:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Mar 2008 23:09:36 -0000 Received: (qmail 21839 invoked by uid 500); 26 Mar 2008 23:09:31 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 21802 invoked by uid 500); 26 Mar 2008 23:09:31 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 21791 invoked by uid 99); 26 Mar 2008 23:09:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Mar 2008 16:09:31 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of andrew.rw.robinson@gmail.com designates 66.249.82.230 as permitted sender) Received: from [66.249.82.230] (HELO wx-out-0506.google.com) (66.249.82.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Mar 2008 23:08:51 +0000 Received: by wx-out-0506.google.com with SMTP id s7so4131468wxc.24 for ; Wed, 26 Mar 2008 16:08:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=w1F0uOSM+J3CPNBz5N4T3qB0fOrjh+mCtztau4I8a2A=; b=XOenSG0iUiA9h9QgSB1OcWhDj815R2tilbC/yaqdx+MM/WaySJSfXzMkfhpM97CrV8qa086999kvjoZ0KUsO1SEjQfJYSXAnr1ucVJ18cQWjOwTp2yRDhTisFynWBXTMlLr8Tly/P1jp7g8/nHVUR2YwvH4rId8C6Wa6Tv+C9c0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=sStqNTVsaEKCn5bE6r9duImBL+/H/TZjEKb2vJAIbFYHu0syEkJqmX2A4rHEdIWWeFSRtUmE47F80Z92gZ39W787Qhb5cWFqu941+YxERF9W+jy50EyNSnHuuhxrX1azVyW/ZXqvYqzWN+d3cpN7OKdBfFufjh+2wwizG1WEkxg= Received: by 10.70.42.16 with SMTP id p16mr668100wxp.14.1206572933548; Wed, 26 Mar 2008 16:08:53 -0700 (PDT) Received: by 10.70.17.6 with HTTP; Wed, 26 Mar 2008 16:08:53 -0700 (PDT) Message-ID: Date: Wed, 26 Mar 2008 17:08:53 -0600 From: "Andrew Robinson" To: "MyFaces Discussion" Subject: Re: [Trinidad] tr:selectOneChoice and Objects that cannot override equals In-Reply-To: <010e01c88f90$535f3470$fa1d9d50$@com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4638131095683041879@unknownmsgid> <010e01c88f90$535f3470$fa1d9d50$@com> X-Virus-Checked: Checked by ClamAV on apache.org The problem is that getAsObject should not return a new Person object, but the exactly the same object that was converted using getAsString. That means you either have to use something like t:saveState, session or conversation scoping or implement an equals method on person. -Andrew On Wed, Mar 26, 2008 at 4:25 PM, Justin mcKay wrote: > That's what I thought as well, but did not seem to work. Let's just say > that the Person object has only one parameter, id which is a Long. So the > getAsString method would just return the id. The getAsObject method would > create a Person object and set the id and return the Person. So far so > good. Well when I try and display the selectOneChoice it still does not > correctly select the proper Person. The log has an entry that says warning > could not find the Person object to be selected. So this suggests that the > value of the selectOneChoice does not get converted, only the selectItems. > This seems to be the case. I have three Persons in the selectItems and a > breakpoint in the converter's getAsString method. When I run it the > breakpoint is only reached three times, where I it should be four (one for > the selectOneChoice's value and three for the three selectItems). Is this > assumption incorrect? > > > > -----Original Message----- > From: Andrew Robinson [mailto:andrew.rw.robinson@gmail.com] > Sent: Wednesday, March 26, 2008 2:03 PM > To: MyFaces Discussion > Subject: Re: [Trinidad] tr:selectOneChoice and Objects that cannot override > equals > > Use a custom converter on the choice that converts your object, or > register a class-converter for all the different classes in your app > that need to be converted. > > On Tue, Mar 25, 2008 at 4:50 PM, Justin Mckay > wrote: > > > > > > > > > > I have a situation where I have some generated objects that do not > override > > equals that I would like to use in a selectOneChoice field. The issue is > > the selected object may not be the same object from the list of objects in > > the selectItems. For instance: > > > > > > > > > > > > > > > > > > > > > > > > So here bean.Person is a generated type Person and peopleFinder.people > will > > be a Map of the same generated type. > > > > > > > > The way we have been handeling this is we have been wrapping the objects > > with another object that has a properly implemented equals method. This > > works but requires us to write more code, I was thinking there would be an > > easier way to do this, any ideas? > > > > > > > > Thanks, > > > > > > > > Justin > >