Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 41857 invoked from network); 11 May 2006 16:09:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 May 2006 16:09:04 -0000 Received: (qmail 44130 invoked by uid 500); 11 May 2006 16:09:01 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 44111 invoked by uid 500); 11 May 2006 16:09:01 -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 44098 invoked by uid 99); 11 May 2006 16:09:01 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 May 2006 09:09:01 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UPPERCASE_25_50 X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [209.86.89.66] (HELO elasmtp-spurfowl.atl.sa.earthlink.net) (209.86.89.66) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 May 2006 09:08:59 -0700 Received: from [66.179.233.5] (helo=carpdev) by elasmtp-spurfowl.atl.sa.earthlink.net with asmtp (Exim 4.34) id 1FeDiP-0005RK-G4 for user-java@ibatis.apache.org; Thu, 11 May 2006 12:08:37 -0400 From: "Mike Carpenter" To: Subject: Can you add a table alias in Abator? Date: Thu, 11 May 2006 12:08:28 -0400 Message-ID: <003701c67515$278e2d70$3e00140a@carpdev> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.3416 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 Importance: Normal X-ELNK-Trace: 9db52930afa1c2dca99c02d1653ca5e740683398e744b8a4deb4ab85fbd35b795921269c20a587942601a10902912494350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 66.179.233.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I'd like to add a table alias to the tables in my Abator config. Something like this: ...
... Notice the addition of the "alias" attribute. This would then crate a mapping like this: ... ... Additionally all the sql statements generated would use this alias. This is useful if I want to extend the Abator generated resultMap in another mapping that might add relationships, like this: ... ... Where "bids" would be a list of bids for the product associated by foreign key. And in my sql query to get the data for this resultMap I can use the alias for the joins to ensure there are no field name collisions: select PROD.PRODUCT_ID as "PROD.PRODUCT_ID", PROD.NAME as "PROD.NAME", PROD.CREATED_BY AS "PROD.CREATED_BY", PROD.CREATED_DATE AS "PROD.CREATED_DATE", B.BID_ID AS "B.BID_ID", B.PRODUCT_ID as "B.PRODUCT_ID", B.AMOUNT AS "B.AMOUNT", B.CREATED_BY AS "B.CREATED_BY", B.CREATED_DATE AS "B.CREATED_DATE" from PRODUCT PROD LEFT OUTER JOIN BID B ON PROD.PRODUCT_ID = B.PRODUCT_ID This way CREATED_BY and CREATED_DATE will resolve to the correct field due to the alias. I'd like to do this because I am creating a new application and database and want to continuously generate the POJOs and sql maps during the build. This way I can extend the POJOs and sql maps Abator generates so changes to the database will always be synchronized with my code on build. So, is there some way to mimic this behavior in Abator today or would it be an enhancement request? Thanks for your help, Mike Carpenter