Return-Path: Delivered-To: apmail-ibatis-dev-archive@www.apache.org Received: (qmail 64420 invoked from network); 5 Apr 2007 01:03:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Apr 2007 01:03:54 -0000 Received: (qmail 55516 invoked by uid 500); 5 Apr 2007 01:04:01 -0000 Delivered-To: apmail-ibatis-dev-archive@ibatis.apache.org Received: (qmail 55357 invoked by uid 500); 5 Apr 2007 01:04:00 -0000 Mailing-List: contact dev-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ibatis.apache.org Delivered-To: mailing list dev@ibatis.apache.org Received: (qmail 55346 invoked by uid 99); 5 Apr 2007 01:04:00 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2007 18:04:00 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2007 18:03:52 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5C77B714068 for ; Wed, 4 Apr 2007 18:03:32 -0700 (PDT) Message-ID: <12725465.1175735012372.JavaMail.jira@brutus> Date: Wed, 4 Apr 2007 18:03:32 -0700 (PDT) From: "Jeff Butler (JIRA)" To: dev@ibatis.apache.org Subject: [jira] Closed: (IBATIS-415) Obey column order in resultMap In-Reply-To: <3861325.1175712332394.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/IBATIS-415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jeff Butler closed IBATIS-415. ------------------------------ Resolution: Invalid iBATIS already retrieves columns in the order they are specified in a result map. As for the issue you raise, there is nothing iBATIS can do. The JDBC specification explicitly states that if multiple columns have the same name in a result set, then only the first one will be returned when getting by column name. The only way to ensure that you'll get the proper columns is to use a column index or to rename the columns so that they are unique. Sorry for the hassle, but blame JDBC - not us :) > Obey column order in resultMap > ------------------------------ > > Key: IBATIS-415 > URL: https://issues.apache.org/jira/browse/IBATIS-415 > Project: iBatis for Java > Issue Type: New Feature > Components: SQL Maps > Affects Versions: 2.3.1 > Reporter: Tony Ugando > > It will be extremely beneficial if iBatis could lookup column names in a resultSet, in the exact same order they are found in the resultMap. This would allow users to maintain joins much easier, specifically for tables with a lot of columns. Maybe an attribute can be added to the resultMap tag, named obeyColumnOrder="true/false". When setting this attribute to true, then the columns will be read in the exact same order that they are found in the resultMap, and any nested or inherited result maps as well. > Currently, it is truly a nightmare when dealing with joined tables that have conflicting column names. You either need to define an alias for each column name, in each table, which is extremely tedious, or you need to use the columnIndex attribute in the result tag. The columnIndex solution is also very tedious to maintain, and it requires you to create multiple resultMaps for each table that you are modeling. > eq. > select > TBL_1.*, TBL_2.* > from TBL_1 > left outer join TBL_2 > on TBL_1.SEQ = TBL_2.FK_SEQ > is much easier to maintain than... > select > TBL_1.SEQ, TBL_1.COL,..., > TBL_2.SEQ, TBL_2.COL,... > from TBL_1 > left outer join TBL_2 > on TBL_1.SEQ = TBL_2.FK_SEQ -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.