l0coful (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5c8fa77...
) *commented* on BVAL-237 (
https://hibernate.atlassian.net/browse/BVAL-237?atlOrigin=eyJpIjoiYWM2ZmY...
)
Re: Expose validated bean via ConstraintValidatorContext (
https://hibernate.atlassian.net/browse/BVAL-237?atlOrigin=eyJpIjoiYWM2ZmY...
)
That’s really unfortunate that for 7 years such a simple fix hasn’t been added to
hibernate validator, and that’s because “in some situations this bean would be null”. So
what?
Note that without this feature you cannot do any contextual validation with hibernate
validator, like for example this:
@Entity class User {
protected Country country;
@GovId
protected String govId;
}
If you want to use this entity to represent users from different countries, and you want
to implement @GovId validator so that it uses different validation for users from
different countries, you currently cannot do it with hibernate validator because there’s
no way to access country field of the User entity from the validation context.
Fortunately there’s a way to do it using beans validation implementation from Micronaut
framework which apparently doesn’t have a problem with injecting root bean into the
validation context.
(
https://hibernate.atlassian.net/browse/BVAL-237#add-comment?atlOrigin=eyJ...
) Add Comment (
https://hibernate.atlassian.net/browse/BVAL-237#add-comment?atlOrigin=eyJ...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100126- sha1:a719cbc )