Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 36419 invoked from network); 8 Jul 2009 19:28:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Jul 2009 19:28:25 -0000 Received: (qmail 36278 invoked by uid 500); 8 Jul 2009 19:28:34 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 36234 invoked by uid 500); 8 Jul 2009 19:28:34 -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 36226 invoked by uid 99); 8 Jul 2009 19:28:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jul 2009 19:28:34 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of Christian.Poitras@ircm.qc.ca designates 207.162.51.9 as permitted sender) Received: from [207.162.51.9] (HELO MGATE.ircm.qc.ca) (207.162.51.9) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jul 2009 19:28:24 +0000 Received: from HERMES.ircm.priv ([172.16.9.26]) by hubcli2.ircm.priv ([172.16.9.32]) with mapi; Wed, 8 Jul 2009 15:28:02 -0400 From: Poitras Christian To: "'user-java@ibatis.apache.org'" Date: Wed, 8 Jul 2009 15:28:01 -0400 Subject: RE: IsEmpty inside Iterate Tag Thread-Topic: IsEmpty inside Iterate Tag Thread-Index: AcoAAHADIdQ0RhuARMGjW7u/kt5yKwAAW+4g Message-ID: <93B0CB1886D4CC48823246865D80DC94038D2AF5E8B9@HERMES.ircm.priv> References: <24397605.post@talk.nabble.com> In-Reply-To: <24397605.post@talk.nabble.com> Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: fr-FR, en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Hi, Can you make it work if you put the list inside a map (under key "list") an= d use this? Insert into someTable (field1, field2, field3) Values (#list[].field1#, #list[].fi= eld2#, NULL, #l= ist[].field3#) Christian -----Original Message----- From: DavidCAIT [mailto:dzazeski@cait.org] Sent: Wednesday, July 08, 2009 3:15 PM To: user-java@ibatis.apache.org Subject: IsEmpty inside Iterate Tag Hi, I am having trouble determining the correct syntax to use with the isEmpty = tag when iterating over a list. My program has a large list of objects with= potentially null fields and I need to customize my insert statements based= on whether or not a particular object has a certain field set to null. Here is my SqlMap file: Insert into someTable (field1, field2, field3) Values (#[].field1#, #[].field2#, NULL, #[].field3#) When I call this sqlMap, the isNotEmpty tag throws the following exception: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [n= ull]; error code [0]; --- The error occurred in org/someFile/mySQL.xml. --- The error occurred while preparing the mapped statement for execution. --- Check the Mapping. --- Check the createObject parameter map. Cause: com.ibatis.common.beans.ProbeException: Error getting ordinal list f= rom JavaBean. Cause java.lang.StringIndexOutOfBoundsException: String index= out of range: -1; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 What syntax should I use in the isNotEmpty property field to avoid this exc= eption? When I remove the isNotEmpty and isEmpty tags, the sql statement ex= ecutes successfully. I tried using property=3D"#[].field2#" and property=3D= "field2" but neither of those statements fixed the problem. Thanks! -- View this message in context: http://www.nabble.com/IsEmpty-inside-Iterate-= Tag-tp24397605p24397605.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org For additional commands, e-mail: user-java-help@ibatis.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org For additional commands, e-mail: user-java-help@ibatis.apache.org