Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 99586 invoked from network); 27 Mar 2009 08:54:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 27 Mar 2009 08:54:44 -0000 Received: (qmail 54744 invoked by uid 500); 27 Mar 2009 08:54:44 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 54690 invoked by uid 500); 27 Mar 2009 08:54:43 -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 54682 invoked by uid 99); 27 Mar 2009 08:54:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Mar 2009 08:54:43 +0000 X-ASF-Spam-Status: No, hits=3.4 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [213.41.74.9] (HELO mail04.net-streams.fr) (213.41.74.9) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Mar 2009 08:54:35 +0000 Received: from ec8l7ljvo9h5dde.hosting.exch [10.16.3.20] by mail04.net-streams.fr with ESMTP (SMTPD-9.10) id A4370308; Fri, 27 Mar 2009 09:54:15 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C9AEB9.CE575042" Subject: Problem with prepend Date: Fri, 27 Mar 2009 09:55:01 +0100 Message-ID: <55DDB08CC9CD2941A70E8D626789A2C911594DF3@ec8l7ljvo9h5dde.hosting.exch> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Problem with prepend Thread-Index: Acmuubbls67jK85LTna5OyBqRYlUGQ== From: "Winarto" To: X-Virus-Checked: Checked by ClamAV on apache.org This is a multi-part message in MIME format. ------_=_NextPart_001_01C9AEB9.CE575042 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi All, =20 I'm having problem with the following select statement. =20 SELECT * FROM contexts workspace_id =3D #workspace_Id# context_id =3D #context_Id# position =3D #position# position =3D 0 =20 The data type of property position is java.lang.Integer. My intention = is: whenever position is not null, use "AND position =3D ?" and whenever = position is null, use "AND position =3D 0". However what I got in my = debug log is the prepend AND before position never come up.=20 Following is the statement generated: When position is not null =E8 SELECT * FROM contexts WHERE workspace_Id = =3D ? position =3D ? When position is null =E8 SELECT * FROM contexts WHERE workspace_Id =3D = ? position =3D 0 =20 I was wondering what's wrong with my dynamic select statement. I'm using = IBatis version 2.3.4.726. I tried to debug the source code and found out = that when it is processing the tag, it tries to get the prepend = attribute of the tag. =20 Can anyone enlighten me? Any help is very much appreciated. =20 Cheers, Winarto =20 ------_=_NextPart_001_01C9AEB9.CE575042 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hi All,

 

I’m having problem with the following select = statement.

 

=A0=A0=A0=A0=A0=A0=A0 SELECT * FROM = contexts

=A0=A0=A0=A0=A0=A0=A0 <dynamic = prepend=3D"WHERE" >

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <isNotNull property=3D"workspace_Id">

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = workspace_id =3D #workspace_Id#

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = </isNotNull>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <isNotNull = prepend=3D"AND" property=3D"context_Id">

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = context_id =3D #context_Id#

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = </isNotNull>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <isNotNull = prepend=3D"AND" property=3D"position">

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = position =3D #position#

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = </isNotNull>

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <isNull = prepend=3D"AND" property=3D"position">

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = position =3D 0

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 = </isNull>

=A0=A0=A0=A0=A0=A0=A0 = </dynamic>

 

The data type of property position is = java.lang.Integer. My intention is: whenever position is not null, use “AND position =3D = ?” and whenever position is null, use “AND position =3D 0”.=A0 = However what I got in my debug log is the prepend AND before position never come = up.

Following is the statement = generated:

When position is not null =E8 SELECT * FROM contexts WHERE workspace_Id =3D ? =A0=A0=A0=A0=A0position = =3D ?

When position is null =E8 SELECT * FROM contexts WHERE workspace_Id =3D ? =A0=A0=A0=A0=A0position = =3D 0

 

I was wondering what’s wrong with my dynamic = select statement. I’m using IBatis version 2.3.4.726. I tried to debug = the source code and found out that when it is processing the <isNull> tag, it = tries to get the prepend attribute of the <dynamic> tag.

 

Can anyone enlighten me? Any help is very much = appreciated.

 

Cheers,

Winarto

 

------_=_NextPart_001_01C9AEB9.CE575042--