Return-Path: Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 33739 invoked by uid 99); 5 Feb 2005 22:13:07 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from v185.mailsnare.net (HELO mail.mailsnare.net) (206.246.200.185) by apache.org (qpsmtpd/0.28) with ESMTP; Sat, 05 Feb 2005 14:13:06 -0800 Received: from [172.16.1.33] (adsl-68-94-25-176.dsl.rcsntx.swbell.net [68.94.25.176]) by mail.mailsnare.net (Postfix) with ESMTP id 50FE55AE8 for ; Sat, 5 Feb 2005 22:13:00 +0000 (UTC) Message-ID: <420544EC.3000201@friendvu.com> Date: Sat, 05 Feb 2005 16:13:00 -0600 From: Vic Cekvenich User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: ibatis-user-java@incubator.apache.org Subject: Re: Flexible ResultMaps (Again) References: <42043D40.1000405@swiftdsl.com.au> <42052B8F.2000809@friendvu.com> <420540D9.1020005@swiftdsl.com.au> In-Reply-To: <420540D9.1020005@swiftdsl.com.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by ClamAV at mailsnare.net X-Virus-Checked: Checked Huy wrote: > > > I see what you mean but I need my domain objects because my apps are > used by different clients with different databases with different > schemas (similar but not exact; it's a legacy thing). The domain > objects help me to keep all my other layers independent of the > database schema. I know I can do "select column as blah" but I really > don't like doing this in all my selects (it could get error prone). > > I really do believe that resultmaps is required for my situation. I > just think it's a good idea to make it just that little bit more > flexible. > > . However, unless you can help me overcome the problem above, I can't > see how I can use it effectively. > So... your domain object can be a Map, just like a bean, read http://groovy.codehaus.org/Quick+Start Old: class person { // at domain level, we do not know if this is one or 2 tables, it's a logical enity; nothing phsycial get/setName{} get/setAddress{} } New: Map person .... person.get("name") person.get("address") SAME THING, you'll get used to it to have a collections for a domain. Anytime you have a hard coded bean.. use a losley typed map. If you have to make a custom map... no big deal**. I learned to let go using actionscript, it was not easy. The 2nd thing that helped me let go of beans is CoR (commons chains)... it allways uses Map as an argument. **side benefit... if you need to add, remove coluns on view or sql... less code. .V (join us CB, the water is warm ;-) ) -- Forums, Boards, Blogs and News in RiA