Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 6748 invoked from network); 4 Nov 2009 22:34:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Nov 2009 22:34:40 -0000 Received: (qmail 34698 invoked by uid 500); 4 Nov 2009 19:44:39 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 34667 invoked by uid 500); 4 Nov 2009 19:44:39 -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 34659 invoked by uid 99); 4 Nov 2009 19:44:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Nov 2009 19:44:39 +0000 X-ASF-Spam-Status: No, hits=-0.2 required=5.0 tests=BAYES_00,FH_HELO_EQ_D_D_D_D,HELO_DYNAMIC_IPADDR X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [87.230.77.175] (HELO lvps87-230-77-175.dedicated.hosteurope.de) (87.230.77.175) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Nov 2009 19:44:36 +0000 Received: (qmail 23609 invoked from network); 4 Nov 2009 20:44:13 +0100 Received: from e181047002.adsl.alicedsl.de (HELO jk) (85.181.47.2) by calitrix.de with (DHE-RSA-AES256-SHA encrypted) SMTP; 4 Nov 2009 20:44:13 +0100 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: user-java@ibatis.apache.org Subject: Re: ibatis 3 COUNT -> Boolean References: <26156026.post@talk.nabble.com> <145103.48797.qm@web50710.mail.re2.yahoo.com> <22B9BBA00A312C4FA4D015127DD6E41E05546567@exchange-sm.BWINC.local> Date: Wed, 04 Nov 2009 20:43:42 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Johannes Klose" Message-ID: In-Reply-To: <22B9BBA00A312C4FA4D015127DD6E41E05546567@exchange-sm.BWINC.local> User-Agent: Opera Mail/10.01 (Linux) You could just modify the query to return a boolean value to avoid conversion issues. For example: SELECT IF(COUNT(username)>0,true,false) FROM record WHERE ... Am 04.11.2009, 19:42 Uhr, schrieb Douglas Bell : > I'm trying to do the following using beta 5 (this was working in beta 3) > > @Select("SELECT COUNT(username) FROM record WHERE username = > #{username,jdbcType=VARCHAR}") > Boolean isExisting(String username); > > I get a ClassCastException: java.lang.Long cannot be cast to > java.lang.Boolean which is understandable. > > I thought adding a @Result(javaType = Boolean.class) would do it but I > still get the same error. Can I do anything short of changing the return > type to a Long and doing the conversion? > > Thanks > > -Doug > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org > For additional commands, e-mail: user-java-help@ibatis.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org For additional commands, e-mail: user-java-help@ibatis.apache.org