Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 45869 invoked from network); 8 Aug 2005 22:15:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Aug 2005 22:15:33 -0000 Received: (qmail 75831 invoked by uid 500); 8 Aug 2005 22:15:27 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 75731 invoked by uid 500); 8 Aug 2005 22:15:26 -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 75634 invoked by uid 99); 8 Aug 2005 22:15:26 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2005 15:15:26 -0700 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 (asf.osuosl.org: domain of larry.meadors@gmail.com designates 64.233.162.199 as permitted sender) Received: from [64.233.162.199] (HELO zproxy.gmail.com) (64.233.162.199) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Aug 2005 15:15:48 -0700 Received: by zproxy.gmail.com with SMTP id n1so651099nzf for ; Mon, 08 Aug 2005 15:15:23 -0700 (PDT) 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:content-disposition:references; b=TAMwaUpxhZP0fMC050za3+ZbeFyzbs1//Z55jM8P9rbWzk4jkD+g041o/CSMRlqUJGlj59jGbGeCNDwlTamN6pfYrpoQEQnSnR+CEu4HJYMotoKQzPve6RK3+pC2WBYWXn4Gm898TcSo9N7+Gl6YuoO/KX/HUmwTE3LYJhfXisk= Received: by 10.36.221.43 with SMTP id t43mr2566556nzg; Mon, 08 Aug 2005 15:15:23 -0700 (PDT) Received: by 10.36.118.10 with HTTP; Mon, 8 Aug 2005 15:15:23 -0700 (PDT) Message-ID: Date: Mon, 8 Aug 2005 18:15:23 -0400 From: Larry Meadors Reply-To: lmeadors@apache.org To: user-java@ibatis.apache.org Subject: Re: Xml Result Mapping In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I agree, iBATIS does 99% of what you want..but not the XML results. Hmm, how do I say this nicely...the XML results that you get from iBATIS suck. (No offense to Clinton, it seemed like a good idea to me, too.) There, I said it, and will have to live with it forever in the archives. When you get a list as XML with iBATIS, you get something like this (abbreviated): 1... 2... 3... So, each item in the list is a complete xml document, not a fragment as you might expect. Obviously, sticking this inside another complete xml document will make a big boom. There are a couple of workarounds that I can think of:=20 One is to get all the stuff as a complex collection, and then build the xml from that. If you want easy coding, and do not care about database performance, this is the way to go. The other is to join all the data, and build a RowHandler to do it (like you'd do if you were trying to fix the N+1 selects problem in 1.x). If you are concerned about database performance, and minimizing the Java memory footprint, this is the way to go. If you need more help, let us know... Larry On 8/8/05, Jason Vinson wrote: > Hi guys, >=20 > First off, sorry if you get this email twice, I sent the first from an > un-subscribed email address. Secondly, iBatis rocks! >=20 > I'm fairly new to iBatis, but I really dig it so far. It's been a breeze= to > get result set -> pojo mapping for complex objects, but I'm having a bit = of > a tough time getting the same complex objects to map to xml. I'm hoping = you > guys could provide some pointers, since I've not found much info on the > internet regarding this. >=20 > Here's the rundown: >=20 > I have a pojo like so: >=20 > public class Entity { >=20 > private String entityClass; >=20 > private String entityClassId; >=20 > private long id; >=20 > private List attributes; >=20 > private List relationshipsOut; >=20 > private List relationshipsIn; >=20 > /** all getters and setters **/ > } >=20 > And in my mapping file I have the following for the pojo mapping: >=20 > >=20 > >=20 > >=20 > >=20 > select=3D"getAttributesByEntityId"/> >=20 > select=3D"getRelationshipsOutByEntityId"/> >=20 > select=3D"getRelationshipsInByEntityId"/> >=20 > >=20 >=20 >=20 > >=20 > >=20 > I am aware that I can change the resultClass to "xml" for the Entity, but > how can I get the sub-select elements (the three lists) to map to xml all= at > once? >=20 > Thanks for a great tool, > Jason >=20 >=20 >