-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Add a failure analyzer for Hibernate bootstrap failure #15006
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
Conversation
@govi20 Thanks very much for looking into this. Ideally, before we merge this, we'd like to also get a test in place. |
@philwebb Okay. I will be writing the test cases for the analyzer. Any idea why this build failed? I didn't make any change in FieldValues.java. |
I'm not sure why the CI failed, you could try rebasing on the latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for opening your first PR to Spring Boot.
This issue is very old as it's quite complex to solve. Last time we had a look to it, there were more cases to take into account. It may very well be that Hibernate has changed and doesn't behave that way anymore. That's why exercising the error is quite important.
protected FailureAnalysis analyze(Throwable rootFailure, | ||
StrategySelectionException strategySelectionException) { | ||
return new FailureAnalysis( | ||
"Dialect value is missing against database or incorrect value is provided!", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need a bit more than that. Hibernate may throw that exception when it cannot access the database. Pointing the user to the potentially wrong fix would causing more harm IMO.
There's no way to prove that our auto-configuration lead to this so pointing to the property may be misleading as well. We usually try to throw dedicated exception whenever we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for flagging it out. I did not test the scenario's with old hibernate version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not so much about old Hibernate version but more about Hibernate failing to boostrap for whatever reason. A good way to move forward would be to contribute tests that are showcasing various cases where Hibernate could not start. We could then use that tests suite as a base for the failure analyzer. Would you be willing to update the PR in that direction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure Stephane, I will start working in that direction.
@govi20 thanks for the PR but this isn't going in the direction the original issue was opened against. I've removed the ideal for contribution label for this one as I believe we need to revisit our initial goal against the current state of affair. Thanks for your efforts, in any case! |
Added the failure analyzer for StrategySelectionException. Hibernate is throwing StrategySelectionException for the missing dialect value.