[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-249?page=all ]
Emmanuel Bernard resolved ANN-249:
----------------------------------
Resolution: Won't Fix
I agree with Guilherme. I don't see real number ranges as useful as integer number
ranges. But you can easily write your own validator
@Range does not support Float/Doubles
-------------------------------------
Key: ANN-249
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-249
Project: Hibernate Annotations
Type: Improvement
Components: validator
Versions: 3.1beta8
Environment: Java1.5.0_06, Hibernate 3.1.2, Annotations 3.1b8
IBM OS/400 DB2 Database
Reporter: Ben Ludkiewicz
Priority: Minor
I am trying to use the Hibernate Validator to annotate a Float property (a price) but
@Range, @Min, and @Max don't seem to support it. When I try adding an 'f' to
the end of the number (9999.99f) or cast it ( (float)9999.99 ) I get an type mismatch
error saying 'cannot convert a float to an int' (for @Min, @Max) or '... a
long' (for @Range). I also tried using a Double instead of a Float and I get the same
errors. The Annotations 3.1b8 reference stats that @Min, @Max, and @Range can be applied
on a "property (numeric or string representation of a numeric)."
I posted this on the forums and got the following response from Emannuel:
[quote="emmanuel"]
acutally the contraints works on Number but the boundaries have to be of type int
currently.
Open a JIRA issue if it's still an issue for you.
[/quote]
Therefore, I am opening this JIRA issue.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira