openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: Bug in AbstractResult with long data types?
Date Fri, 03 Jul 2009 20:09:27 GMT

On Jul 3, 2009, at 12:09 PM, Craig L Russell wrote:

> I've been looking at the result handling and ran across this code in  
> org.apache.openjpa.jdbc.sql.AbstractResult.
>
>    public long getLong(Object obj)
>        throws SQLException {
>        return getLongInternal(translate(obj, null), null);
>    }
>
>    public long getLong(Column col, Joins joins)
>        throws SQLException {
>        return getLongInternal(translate(col, joins), joins);
>    }
>
>    protected long getLongInternal(Object obj, Joins joins)
>        throws SQLException {
>        Number val = (Number) checkNull(getObjectInternal(obj,
>            JavaTypes.INT, null, joins));
>        return (val == null) ? 0 : val.intValue();
>    }
>
> It seems like it's an obvious bug; using intValue and JavaTypes.INT  
> in getLongInternal should use longValue and JavaTypes.LONG.
>
> 1. Is this as obvious an error as it seems to me?
>
> 2. If it is an error, why don't we see it in all of our tests that  
> have long types in the domain model?

Because the JDBC classes override the getXXXInternal methods. This  
method is never called.

I'll file a JIRA and fix it.

Craig
>
> Thanks,
>
> Craig
>
> Craig L Russell
> Architect, Sun Java Enterprise System http://db.apache.org/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com
> P.S. A good JDO? O, Gasp!
>

Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message