Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Hibernate ORM with Hibernate Validator #2753

Merged
merged 1 commit into from
Jun 19, 2019

Conversation

machi1990
Copy link
Member

@machi1990 machi1990 commented Jun 7, 2019

@gsmet this follows up our discussion on Zulip chat on how to go about #1889.

Your feedbacks are welcomed as usual :-)

Fixes #1889

@machi1990 machi1990 force-pushed the 1889 branch 2 times, most recently from 1fb7eca to 27f4704 Compare June 10, 2019 18:50
Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@machi1990 thanks!

I added an important question inline. Could you explain your rationale?

extensions/hibernate-orm/deployment/pom.xml Outdated Show resolved Hide resolved
.initializeBeanMetaData(classesToBeValidated)
.initializeLocales(localesToInitialize)
.beanMetaDataClassNormalizer(new ArcProxyBeanMetaDataClassNormalizer());

ValidatorHolder.initialize(configuration.buildValidatorFactory());
ValidatorHolder.initializeHibernateValidator(hibernateValidatorConfiguration.buildValidatorFactory());
ValidatorHolder.initializePredefinedScopeValidator(predefinedScopeValidatorConfiguration.buildValidatorFactory());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why you define 2 different validators?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is because I was getting this

java.lang.IllegalStateException: Defining a Validator-specific traversable resolver is not supported by the predefined scope ValidatorFactory.

when trying to use PredefinedScopeHibernateValidatorFactory.

Any ideas?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, right. So that's something we need to fix in HV. I was a bit too conservative on what would be accepted.

TBH, I didn't think the traversable resolver would be set for each JPA validation call.

Could you change your code to use the initial ValidatorFactory (well, it will mostly be a matter of reverting changes)? I'll push a PR to HV so that you can test if it works OK for you.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@machi1990 can you check with this branch of Hibernate Validator: hibernate/hibernate-validator#1039 ?

It should solve the issue and you should be able to have only one VF.

I'll wait for your feedback before merging and releasing a new alpha.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@machi1990 can you check with this branch of Hibernate Validator: hibernate/hibernate-validator#1039 ?

It should solve the issue and you should be able to have only one VF.

I'll wait for your feedback before merging and releasing a new alpha.

@gsmet thanks for the quick response. It solves the problem.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gsmet Hi, any news on the HV release?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, still in the pipeline. I'm preparing a talk and didn't find the time to do it.

I think I should be able to push the release button this afternoon.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, release done. Now, we have to wait for it to be synced to Central. Hopefully, it will be synced today and I'll push an upgrade PR to fix another issue and prepare for this one.

@machi1990 machi1990 marked this pull request as ready for review June 17, 2019 07:33
@machi1990
Copy link
Member Author

@gsmet finally, we are ready for a full review :-)

@gsmet gsmet self-assigned this Jun 17, 2019
@gsmet
Copy link
Member

gsmet commented Jun 18, 2019

@machi1990 just a status: I worked on this one yesterday, trying to get the bean manager working. It's a bit more complicated than expected to get things working.

I hope I'll get something working before the release.

@machi1990
Copy link
Member Author

@machi1990 just a status: I worked on this one yesterday, trying to get the bean manager working. It's a bit more complicated than expected to get things working.

I hope I'll get something working before the release.

Thanks for the update. Hope we get it working before the release.And then I'll be interested in finding out how you did it.

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't have the time to finish the bean manager part before the release and this is already a big improvement so let's merge it.

@gsmet gsmet changed the title feat(#1889): consider validation annotations when generating tables Integrate Hibernate ORM with Hibernate Validator Jun 19, 2019
@gsmet gsmet added this to the 0.17.0 milestone Jun 19, 2019
@gsmet gsmet merged commit d655fb2 into quarkusio:master Jun 19, 2019
@gsmet
Copy link
Member

gsmet commented Jun 19, 2019

Thanks @machi1990 ! I'll ping you when I create the bean manager PR.

@machi1990 machi1990 deleted the 1889 branch June 19, 2019 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integrate Hibernate Validator with Hibernate ORM
2 participants