[
http://opensource.atlassian.com/projects/hibernate/browse/HV-21?page=com....
]
Natalia K commented on HV-21:
-----------------------------
I have found the same bug and hope to it's fixing soon.
Emmanuel, I think - no overlapping should be done. Or at least there should be a way to
override annotation completely. Because it should correspond to the meaning of overriding
itself. If you override something - you try to change it. Not to save old behavior and add
something new, but completely change. That's why you usually use overriding.
In our project we had been trying to use Hibernate Validator, but got stuck with this bug.
If it is fixed in the future, we will be able to use HV.
For example, we have hierarchy, and in general we have property "age" within
range(15,45). But for only one child we should change this range. And I want to have an
opportunity to override that range.
If you can recommend something to override annotation in a different way, please, let me
know that way.
Beforehand thank you for help.
Base class validations are not over-ridden
------------------------------------------
Key: HV-21
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-21
Project: Hibernate Validator
Issue Type: Improvement
Components: engine
Environment: hibernate 3.2 cr2
Reporter: Aseel Abbas
When the same validation annotation is applied to an over-riding method in a subclass the
expected behaviour is that the validation annotation in the base class is over-ridden.
Currently, both validations are executed. This severely limits the usability of the
package for domain models where inheritance is used.
The problem also occurs with over-riding interfaces.
For example:
class A {
@Length (min = 0, max = 32)
Integer getFoo() {
return foo;
}
}
class B extends A
{
@Length (min = 15, max = 20)
Integer getFoo() {
return super.getFoo();
}
}
In this case validating an instance of class B which has a foo value of 100 will result
in two error messages: "foo must be between 15 and 20" and "foo must be
between 0 and 32".
--
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