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
...@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
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 db...@boingo.com:
I'm trying to do the following using beta 5 (this was
That may depend on the database. In Oracle boolean is not a datatype so that
wouldn't work.
WMMV.
--- li...@calitrix.de wrote:
From: Johannes Klose li...@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
here is the java doc for how the resultset implementation should handle
this. As long as your query will only return 0/1 you should be okay. If
not, then I would just wrap the count() in an if and return a 1 if count was
more than 1.
I would also set both the jdbc type and the return type.