[hibernate-issues] [Hibernate-JIRA] Created: (HV-350) Inherited Bean validates non-default constraints as default
Marc Schipperheyn (JIRA)
noreply at atlassian.com
Sat Jul 3 09:18:13 EDT 2010
Inherited Bean validates non-default constraints as default
-----------------------------------------------------------
Key: HV-350
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-350
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.1.0.Final
Environment: Spring 3.0.3
Reporter: Marc Schipperheyn
Assignee: Hardy Ferentschik
Let's say you have 2 beans
public class Vehicle{
@AssertTrue(groups={CheckMaintenance.class,CheckRoad.class})
public boolean oilCheck;
@NotNull(groups={CheckRoad.class})
public String plate;
}
public class Car extends Vehicle{
@Min(value=4)
public int numWheels;
}
validate(car,Class<?>[]{Default.class,CheckMaintenance.class});
If I validate Car, all the Vehicle validations are selected as Defaults as opposed to by their specific marker interface. In other words, Validator validates plate regardless of the fact that CheckRoad is not part of the array of marker interfaces specified for this validation. I assume this has something to do with the inherited nature of the class.
Stepping through the code, I can also see that the groups Descriptor of the ConstraintDescriptorImpl 'loses' non default groups for the inherited constraints.
--
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list