Return-Path: Delivered-To: apmail-incubator-ibatis-user-java-archive@www.apache.org Received: (qmail 77899 invoked from network); 27 May 2005 10:45:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 May 2005 10:45:57 -0000 Received: (qmail 92246 invoked by uid 500); 27 May 2005 10:45:55 -0000 Delivered-To: apmail-incubator-ibatis-user-java-archive@incubator.apache.org Received: (qmail 92199 invoked by uid 500); 27 May 2005 10:45:54 -0000 Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Precedence: bulk Reply-To: ibatis-user-java@incubator.apache.org List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list ibatis-user-java@incubator.apache.org Delivered-To: moderator for ibatis-user-java@incubator.apache.org Received: (qmail 38977 invoked by uid 99); 27 May 2005 05:59:50 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=FORGED_RCVD_HELO,HTML_90_100,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) From: "Ritu Kedia" To: Subject: Question on dynamic Select Columns Date: Fri, 27 May 2005 11:38:22 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0043_01C562B0.968FF4B0" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcVigiOSc5NjCB4TQnOOihAr3YS8yQ== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-ID: X-OriginalArrivalTime: 27 May 2005 05:59:53.0266 (UTC) FILETIME=[4D08E920:01C56281] X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. ------=_NextPart_000_0043_01C562B0.968FF4B0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hello All, This is my first post to IBatis. We are planning to use IBatis as our OR-Mapping tool. First of all thanks to all the contributors for this great contribution. I particularly liked the dynamic SQl feature. I have a question on whether the select columns can also be made dynamic? Currently I am getting SQLException for Invalid Column Name when the framework is trying to map the fetched data to the declared Result Map. OR Could we bind the ResultMap dynamically to the Select statement? In other words could we have something like: Where $resultMap$ would be passed via the Java API. If the resultMap is hard bound to the following: In the above select if the resultMap="Detail_ResultMap" then when property "fetchDetails" is not present then I get a SQLException "Invalid Column Name" for the Description column. Could someone please suggest a way to accommodate the above requirement of having dynamic select columns? Thanks and Regards, Ritu Kedia ------=_NextPart_000_0043_01C562B0.968FF4B0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hello All,

 

This is my first post to IBatis. We are planning to = use IBatis as our OR-Mapping tool.

 

First of all thanks to all the contributors for this = great contribution. I particularly liked the dynamic SQl = feature.

 

I have a question on whether the select columns can = also be made dynamic? Currently I am getting SQLException for Invalid Column = Name when the framework is trying to map the fetched data to the declared Result = Map.

 

OR Could we bind the ResultMap dynamically to the = Select statement? In other words could we have something = like:

      <select = id=3D"FindDynamic" resultMap=3D"$resultMap$">

        &n= bsp;   SELECT      ID,

        &n= bsp;           &nb= sp;   NAME

        &n= bsp;   <dynamic = prepend=3D",">

        &n= bsp;         <isNotNull = property=3D"fetchDetails">

        &n= bsp;           &nb= sp;   DESCRIPTION,

        &n= bsp;         </isNotNull>

        &n= bsp;   </dynamic>

        &n= bsp;   FROM  SOME_TABLE

        &n= bsp;   <dynamic = prepend=3D"WHERE">

        &n= bsp;         <isNotNull = prepend=3D"AND" property=3D"name">

        &n= bsp;           &nb= sp;   NAME $name_operator$ #name#

        &n= bsp;         </isNotNull>

        &n= bsp;         <isNotNull = prepend=3D"AND" property=3D"description">

        &n= bsp;           &nb= sp;   DESCRIPTION $description_operator$ #description#

        &n= bsp;         </isNotNull>

        &n= bsp;   </dynamic>     &= nbsp; 

      </select>

Where $resultMap$ would be passed via the Java = API.

 

If the resultMap is hard bound to the = following:

      <resultMap = id=3D"Detail_ResultMap" class=3D"Some_Detail">

        &n= bsp;   <result = property=3D"name" column=3D"Name"/>

        &n= bsp;   <result = property=3D"description" column=3D"Description"/>

        &n= bsp;   <result = property=3D"id" column=3D"ID"/>

      </resultMap>

 

In the above select = if the resultMap=3D”Detail_ResultMap” then when property = “fetchDetails” is not present then I get a SQLException “Invalid Column = Name” for the Description column.

 

Could someone = please suggest a way to accommodate the above requirement of having dynamic select = columns?

 

Thanks and = Regards,

Ritu = Kedia

------=_NextPart_000_0043_01C562B0.968FF4B0--