Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Integrate Java Bean validation so it works out of the box on the persistence path #4444
We bundle Java Bean validation with one of our Cordapps. This used to work fine but we are now running into issues with the current master branch and upcoming Corda 4.0:
I have not so far fully understood what is going on in the class loader area. For some strange reason
Maybe bean validation is something that might be one day officially supported. Short-term this flag could be helpful for people. Or maybe rather a more general mechanism to set any Hibernate property.
It could also be interesting to have validation support natively built into Corda since it is probably quite a common topic.
Our validator looks like:
and we make use of this dependency:
@remmeier It seems the issue steps from the fact that CorDapps are no longer added to the node's system classpath. Hibernate Validator automatically does its thing if it is. From https://docs.jboss.org/hibernate/validator/5.1/reference/en-US/html/validator-integration.html#validator-checkconstraints-db:
The node has a
To answer your question as to why although BeanValidationIntegrator.isBeanValidationApiAvailable returns true, it is later not able to fully load bean validation.
It seems to be a bug in the BeanValidationIntegrator.
It assumes that validation-api needs to be on the system classloader (where hibernate is).
These lines here:
Probably worth raising with hibernate.