Return-Path: Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 29721 invoked by uid 99); 8 Feb 2005 19:53:06 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of brandon.goodin@gmail.com designates 64.233.170.193 as permitted sender) Received: from rproxy.gmail.com (HELO rproxy.gmail.com) (64.233.170.193) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 08 Feb 2005 11:53:06 -0800 Received: by rproxy.gmail.com with SMTP id r35so1062489rna for ; Tue, 08 Feb 2005 11:53:04 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=bxFrOEWQ07NpKMjaQd0UjRqkcDNSP+ZfN+kQFcnoTw2NWi/JGwEH5Bd/JHlMdy3DyLAWbkpqTvFXPwo2FoJtdVPr8xeqRRc8+X8GqjawHcnyfz44MRMXkAPLqDJmDXG8N2i25LoZcoy14c6FTAY3p8cbVw/tBOKeEUdqCxQyn1w= Received: by 10.38.12.74 with SMTP id 74mr119619rnl; Tue, 08 Feb 2005 11:53:03 -0800 (PST) Received: by 10.38.74.53 with HTTP; Tue, 8 Feb 2005 11:53:03 -0800 (PST) Message-ID: <2fe5ef5b0502081153124c4b9a@mail.gmail.com> Date: Tue, 8 Feb 2005 12:53:03 -0700 From: Brandon Goodin Reply-To: Brandon Goodin To: ibatis-user-java@incubator.apache.org Subject: Re: SQL Map problem when map keyed on attribute not in object In-Reply-To: <20050208185226.37744.qmail@web54101.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20050208185226.37744.qmail@web54101.mail.yahoo.com> X-Virus-Checked: Checked why don't you simply create another resultMap or set resultClass to HashMap? Brandon On Tue, 8 Feb 2005 10:52:26 -0800 (PST), Michael Klaene wrote: > I have 2 tables, user and role, and an associate table user_role which, as > you would expect contains user_role_id,user_id, and role_id keys. I want to > read the following query into a map of userRole objects that will be keyed > on role name (from the Role object): > > > SELECT role.name, user_role.user_role_id,user_role.user_id, > user_role.role_id, user_role.default_role, > user_role.status,user_role.created_on,user_role.created_by, > user_role.updated_on, user_role.updated_by > FROM role, user_role > WHERE user_role.user_id = #value# > AND user_role.role_id = role.role_id > > > And I'm currently trying to do this using the following result map, which > mirrors the userRole object: > > > > > > > > > > > > > > Obviously it doesn't work as name is not an attribute of userRole and I'd > rather not add it to the object for just this task. Is there another way I > might accomplish this via a SQL Map (ie without extra Java code to build the > map after the sql map call)? > > Thanks, > Mike > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com