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 43254 invoked by uid 99); 5 Feb 2005 06:23:55 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from smtp.syd.swiftdsl.com.au (HELO smtp.syd.swiftdsl.com.au) (218.214.224.138) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 04 Feb 2005 22:23:54 -0800 Received: (qmail 14029 invoked from network); 5 Feb 2005 06:24:02 -0000 Received: from unknown (HELO ?192.168.1.10?) (202.154.115.188) by smtp.syd.swiftdsl.com.au with SMTP; 5 Feb 2005 06:24:02 -0000 Message-ID: <42046677.7020904@swiftdsl.com.au> Date: Sat, 05 Feb 2005 17:23:51 +1100 From: Huy 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: A question about nullValue in resultMap. References: <42fd16a805012812104c7cdca1@mail.gmail.com> <420035EF.4090109@swiftdsl.com.au> <42021E5F.8000901@swiftdsl.com.au> <42fd16a80502041223d43a179@mail.gmail.com> <16178eb1050204124250003758@mail.gmail.com> <420437B3.4000400@swiftdsl.com.au> <16178eb105020419486721dc9d@mail.gmail.com> In-Reply-To: <16178eb105020419486721dc9d@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked Clinton Begin wrote: >>I've never liked to use Integer. Is it really the >>better design choice ? and why ? Is it the > > > Not for all situations. But the simple fact is that a primitive > cannot represent NULL state without using a "magic number". Magic > numbers are (to the best of my experience and education) NEVER a good > idea. Hence, you're better off with an Integer than a "magic int". I have to admit I was always of the opposite view. I hated nulls with a vengeance when it came to database data. I also don't like magic numbers unless they had meaning in the given domain. Most of the time (95%) zero made perfect senses hence I always defaulted my database columns to zero (never -1 or anything like that). In cases where I needed to know the difference between zero and null (which was rare) there were always other ways to represent this (eg. existence of a row etc.) >>From a practical perspective, Integers are better because they are > objects and can take part in Object features. For example, you can > use them in a collection or pass them as a parameter to your SQL Maps. > If you're lucky enough to use J2SE 5, then this is less > important...but trust me, primitives are no less of a problem in J2SE > 5. This is a major problem I found with java; i.e not being able to use primitives in collections. I think either primitives is a real wart in java or collections is missing a real feature. That reminds me of a little annoyance with sqlmap where I always had to wrap my primitives in Integer, Boolean etc when passing it to the query, update methods. >>From a purely academic sense, Java is a hybrid language. A Smalltalk > developer would tell you to avoid primitives like the plague. A C > developer, would tell you primitives are the only way to go. > Generally speaking, Java is more OO than not, so the Smalltalk > developer would probably be correct more often than the C developer. > > All I can say is...dude, you'd love Ruby. ;-) I'm actually a python fan and i'm sure you know about the rivalry there ;-) There are some nice features in ruby though. But I think that activerecord (ruby on rails) thing they have doesn't come close to sqlmaps for major applications. Regards, Huy