ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason H King" <jhk...@airmail.net>
Subject Re: ibatis 3 COUNT -> Boolean
Date Wed, 04 Nov 2009 20:34:32 GMT
That may depend on the database.  In Oracle boolean is not a datatype so that wouldn't work.
WMMV.

--- lists@calitrix.de wrote:

From: "Johannes Klose" <lists@calitrix.de>
To: user-java@ibatis.apache.org
Subject: Re: ibatis 3 COUNT -> Boolean
Date: Wed, 04 Nov 2009 20:43:42 +0100

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 <DBell@boingo.com>:

> 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




---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message