I'm not sure about the iBatis piece, but that doesn't make sense as sql.
Count returns a number.  That number might be 0 or any other non-negative 
integer.
AFAIK java doesn't do the 0 = false, non-zero = true conversion you have in 
C/C++.

--- db...@boingo.com wrote:

From: "Douglas Bell" <db...@boingo.com>
To: <user-java@ibatis.apache.org>
Subject: ibatis 3 COUNT -> Boolean
Date: Wed, 4 Nov 2009 10:42:29 -0800

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-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org




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

Reply via email to