Won't Fix
Details
Assignee
Steve EbersoleSteve EbersoleReporter
Steve EbersoleSteve EbersoleComponents
Affects versions
Priority
Trivial
Details
Details
Assignee
Steve Ebersole
Steve EbersoleReporter
Steve Ebersole
Steve EbersoleComponents
Affects versions
Priority
Created January 23, 2006 at 4:10 PM
Updated February 10, 2006 at 12:01 AM
Resolved February 10, 2006 at 12:01 AM
In both cases this is due to the fact that the negation sign is handled seperately in the AST tree (as a UNARY_MINUS). This works out fine in the resulting SQL in the majority of cases.
However it breaks down specifically in the case of the MIN_VALUEs because of numeric overflow issues trying to parse the numbers. For both Integer and Long: ( MAX_VALUE == ( -MIN_VALUE ) - 1 ).
For example, for Integer: MIN_VALUE = -2e31 while MAX_VALUE = 2e31-1. Therefore the HQL:
("from Animal a where a.integer = " + Integer.MIN_VALUE) will fail because the negation sign is removed leaving 2e31 to be processed as the numeric literal value, which is bigger than Integer.MAX_VALUE.
I added a workaround while fixing such that a NumberFormatException on parsing an Integer will attempt to parse as a Long in anticipation that the format issue might be an overflow issue. Thus, really only Long.MIN_VALUE is currently a problem.