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 Bug in AbstractResult with long data types?
Date Fri, 03 Jul 2009 19:09:16 GMT
I've been looking at the result handling and ran across this code in  

     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?



Craig L Russell
Architect, Sun Java Enterprise System
408 276-5638
P.S. A good JDO? O, Gasp!

View raw message