I'm currently using following mapping:
@Select ("select count(*) from something where id = 2344")
int userExists();
But i would like to have something like:
@Select ("select count(*) from something where id = 2344")
boolean userExists();
Can I convert 0 to false and everything > 0 to true ?
I'm using Oracle. Therefore I hope that my-batis provides some sort of return type mapping.
Here is how you can return boolean in Oracle, by using the case statement in Oracle:
@Select ("select case when count(*) > 0 then 1 else 0 end result from something where id = 2344")
boolean userExists();
Hope it is helpful to you.