Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 60310 invoked from network); 29 Jun 2005 15:28:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 Jun 2005 15:28:59 -0000 Received: (qmail 70177 invoked by uid 500); 29 Jun 2005 15:28:57 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 70151 invoked by uid 500); 29 Jun 2005 15:28:56 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 70132 invoked by uid 99); 29 Jun 2005 15:28:56 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jun 2005 08:28:56 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [205.194.19.87] (HELO scmze003.ssan.egs-seg.gc.ca) (205.194.19.87) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jun 2005 08:28:59 -0700 Received: from humpty.pwgsc.gc.ca (HELO mh-ncr-010.ad.pwgsc-tpsgc.gc.ca) (198.103.167.20) by scmze003.ssan.egs-seg.gc.ca with ESMTP; 29 Jun 2005 11:28:55 -0400 X-BrightmailFiltered: true X-Brightmail-Tracker: AAAAAQAAA+k= Received: from mb-ncr-025.ad.pwgsc-tpsgc.gc.ca ([10.20.19.200]) by mh-ncr-010.ad.pwgsc-tpsgc.gc.ca with Microsoft SMTPSVC(5.0.2195.6713); Wed, 29 Jun 2005 11:28:54 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Automatically Create Maps Date: Wed, 29 Jun 2005 11:28:54 -0400 Message-ID: <0AA6D604B971D544A755A45BA081CC681CD752@mb-ncr-025.ad.pwgsc-tpsgc.gc.ca> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Automatically Create Maps Thread-Index: AcV8uE1OcR+VfUdKS3CnN1cN6UJdUQABbW8g From: "Mike Fotiou" To: , X-OriginalArrivalTime: 29 Jun 2005 15:28:54.0727 (UTC) FILETIME=[42902D70:01C57CBF] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Sorry, I just have been more concise: I'm not talking about simple key-value maps that represent a row in a = table. I need to create a Map of objects, not a List of objects. I = typically represent associations using a Map, that way I can easily = find/remove objects using the key. As an example, a User object could contain many Role objects. The roles = are held in a Map and the key is the Role identifier, in this case it = would be something like roleCode. The client can then say = user.getRoles().get("CLERK"). Or you could use user.isInRole("CLERK") - = the method would be able to just use map.containsKey("CLERK"), instead = of iterating through the List, casting each element to a Role object, = and then examining the roleCode property. IBATIS will only create associations if the setter method is a List or = Collection. I think a Map would require something else in the DTD to = specify a key value. E.G. Mapping - the key value is "roles" in the user ResultMap - it's = cross linked to the "getUserRolesById" select mapping which is used to = build UserRole objects through the "userRole" mapping. This creates a = role ArrayList contain UserRole objects, but I want a HashMap (or = LinkedHashMap) containing UserRole objects keyed by the property = roleCode (or the column ROLE_CODE). .... other properties -----Original Message----- From: Larry Meadors [mailto:larry.meadors@gmail.com] Sent: Wednesday, June 29, 2005 10:39 AM To: user-java@ibatis.apache.org Subject: Re: Automatically Create Maps Yes, there is. On 6/29/05, Mike Fotiou wrote: > =20 > Is there any way in IBATIS to create a Map via the XML file instead of = a > List/Collection? This is possible programmatically using queryForMap. = If > not, would it be useful in a future version of IBATIS?