ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: problem returning primitive types from a query
Date Mon, 07 Jan 2008 22:08:44 GMT
I'm guessing the values in the database are null. If they are, the
result map types have to be wrapped - you can't represent null in a
primitive, even with boxing.

If that is not adequate, your other option is to make the SQL provide
a default value for null values.

Larry


On Jan 7, 2008 1:54 PM, dandante <dandante@dandante.com> wrote:
>
> In my bean I have the following properties defined along with their
> corresponding getters and setters:
>
> int ownerId;
> boolean isPrivate;
>
> In my result map I map these columns as follows:
>        <result property="ownerId" column="owner_id" jdbcType="int"
> javaType="int"/>
>        <result property="private" column="is_private" jdbcType="BIT"
> javaType="boolean"/>
>
> Then I run a query that returns this result map. I get the following error:
> java.lang.RuntimeException:
> com.ibatis.common.jdbc.exception.NestedSQLException:  --- The error occurred
> in org/systemsbiology/GWAP/domain/Condition.xml. --- The error occurred
> while applying a result map. --- Check the
> Condition.ConditionGroupWithConditionsResultMap. --- The error happened
> while setting a property on the result object. --- Cause:
> net.sf.cglib.beans.BulkBeanException
> [...]
>
> If I change the bean to use wrapper types (Integer and Boolean) it works
> fine. But I would rather use primitive types.
>
> Hope you can help.
>
> Also, will the next version of IBATIS be java 1.5+ compatible? If so, would
> this issue be resolved by boxing and unboxing?
>
> Thanks
> --
> View this message in context: http://www.nabble.com/problem-returning-primitive-types-from-a-query-tp14675618p14675618.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Mime
View raw message