[hibernate-issues] [Hibernate-JIRA] Commented: (HV-533) @Digits.fraction should allow negative values
Devesh Parekh (JIRA)
noreply at atlassian.com
Tue Jan 10 15:26:09 EST 2012
[ http://opensource.atlassian.com/projects/hibernate/browse/HV-533?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45076#comment-45076 ]
Devesh Parekh commented on HV-533:
----------------------------------
Fair enough. How about this: it would be very useful to be able to specify a negative number for fraction. For example, if you have a Money bean with a field for micros, it would be useful to say that values representing fractions of a cent are not valid without having to write a custom ConstraintValidator.
To allow this, the documentation should be cleared up to specify behavior for negative values of @Digits.fraction (similar behavior to JPA's @Column.scale), and the implementation should be fixed to deal with negative values. Alternatively, if we don't want to allow negative values, the documentation should clearly state that. (I dislike this alternative.)
> @Digits.fraction should allow negative values
> ---------------------------------------------
>
> Key: HV-533
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-533
> Project: Hibernate Validator
> Issue Type: Bug
> Components: documentation, validators
> Affects Versions: 4.2.0.Final
> Reporter: Devesh Parekh
>
> There are really two bugs here:
> 1. The documentation for @Digits.fraction does not concretely say what should happen for negative values, but the 1.0 final spec defines the correct behavior on page 133 with the equation @Column.precision = @Digits.integer + @Digits.fraction. This suggests that @Digits.fraction should be negative when @Column.scale is negative.
> 2. The implementation throws an IllegalArgumentException when @Digits.fraction is negative.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list