From user-java-return-15474-apmail-ibatis-user-java-archive=ibatis.apache.org@ibatis.apache.org Thu Oct 23 12:41:54 2008 Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 73354 invoked from network); 23 Oct 2008 12:41:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Oct 2008 12:41:54 -0000 Received: (qmail 3251 invoked by uid 500); 23 Oct 2008 12:41:54 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 3238 invoked by uid 500); 23 Oct 2008 12:41:54 -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 3227 invoked by uid 99); 23 Oct 2008 12:41:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2008 05:41:54 -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 jeffgbutler@gmail.com designates 66.249.92.172 as permitted sender) Received: from [66.249.92.172] (HELO ug-out-1314.google.com) (66.249.92.172) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2008 12:40:41 +0000 Received: by ug-out-1314.google.com with SMTP id s2so1583996uge.1 for ; Thu, 23 Oct 2008 05:41:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; 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=oDWUdHhU7M893eBlV2i4WVj4ABNGfXmgzcitKQa6Sa8=; b=ZIC1KieDXpuyK3t16uwO4woav8VwnG3bvyyvnx+dLJD5owbL/Bn+unhwsAOC/h8+ct qQqS2cuiYqIAbfAwFjmd0OQl5X0/LbloZkoHfFfK7C4tkv7yW3WbUcVsKxQ3weBKVTUR 8w/OpzGphWEXNlBF/NNCvbRKI9dcmMsES9xF8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=YyBEHwcEyZrkJ9dnHq1rNipycq2JWFfFyWIc1b2XAVb23dOO8MwWceeVUeckSsk+SL TCdD4uLTgQ/qBVxXBRX6QiR5p/Rt6TNYcWv7slvsUFZvQcJXXbCA8pwqqXvFTas79rUw 0gXDI6urSYkP5sW1bLFwniKMns9NybcnveakI= Received: by 10.67.106.13 with SMTP id i13mr4552347ugm.37.1224765677164; Thu, 23 Oct 2008 05:41:17 -0700 (PDT) Received: by 10.67.15.13 with HTTP; Thu, 23 Oct 2008 05:41:17 -0700 (PDT) Message-ID: Date: Thu, 23 Oct 2008 07:41:17 -0500 From: "Jeff Butler" To: user-java@ibatis.apache.org Subject: Re: execution of nested result maps depends on number of mapped properties? In-Reply-To: <490061EB.9010409@asci-systemhaus.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <49003F6F.7080408@asci-systemhaus.de> <490061EB.9010409@asci-systemhaus.de> X-Virus-Checked: Checked by ClamAV on apache.org This is a known bug: http://issues.apache.org/jira/browse/IBATIS-357 http://issues.apache.org/jira/browse/IBATIS-450 Feel free to attach a patch if you've got one. Jeff Butler On Thu, Oct 23, 2008 at 6:37 AM, Ingmar L=F6tzsch wrote: > Hello, > > I found the reason for my problem is the following method in class > ResultMap, line 310: > > public Object[] getResults(StatementScope statementScope, ResultSet rs) > throws SQLException { > ... > boolean foundData =3D false; > Object[] columnValues =3D new Object[getResultMappings().length]; > for (int i =3D 0; i < getResultMappings().length; i++) { > ResultMapping mapping =3D (ResultMapping) getResultMappings()[i]; > errorContext.setMoreInfo(mapping.getErrorString()); > if (mapping.getStatementName() !=3D null) { > ... > foundData =3D foundData || columnValues[i] !=3D null; > } else if (mapping.getNestedResultMapName() =3D=3D null) { > columnValues[i] =3D getPrimitiveResultMappingValue(rs, mapping); > if (columnValues[i] =3D=3D null) { > columnValues[i] =3D doNullMapping(columnValues[i], mapping); > } else { > foundData =3D true; > } > } > // TODO: add a check for the case > // mapping.getNestedResultMapName() !=3D null > } > > statementScope.setRowDataFound(foundData); > > return columnValues; > } > > The value of foundData remains false, if there are only mappings with nes= ted > result maps. This proceeding assumes that there is no data in this case. = But > this assumption seems to be wrong. For the nested result maps one have to > check, if ResultSet.wasNull() returns true, I think. > > else { > // check the return value of ResultSet.wasNull() > if (ResultSet.wasNull() has returned false) { > foundDate =3D true; > } > } > > Ingmar >