Add failure analysis for Hibernate bootstrap failures - #51510
Conversation
Signed-off-by: hej090224 <fc49854985@gmail.com>
|
I think this is too big a leap forward as we haven't yet gathered all of the relevant information. There are various scenarios discussed in #1573. The point is also made that the reported behavior is, to some extent at least, a Hibernate problem. Also, someone mentioned submitting a Hibernate pull request to improve things on that side but it's not clear if that happened. As I said on #1573, the step that we need to take first is to gather information about how Hibernate behaves. Once we have that information for the various scenarios discussed in #1573 (and perhaps any others that we think may be common), we can review the situation and decide what, if anything, we want to do on the Spring Boot side and what, if anything, still needs to be improved on the Hibernate side. Thanks anyway for the PR. Please update #1573 with your findings thus far and we can review. |
Description
When Hibernate cannot obtain JDBC metadata during JPA bootstrap, the resulting
ServiceExceptioncontains aHibernateExceptionreporting that the dialect could not be determined. Spring Boot currently has JDBC failure analyzers, but none of them handles this Hibernate bootstrap failure, so the underlying configuration problem is not explained by failure analysis.This change adds a focused analyzer that matches the
ServiceException/HibernateExceptioncause structure produced by Hibernate ORM 7.4.5.Final and the stableUnable to determine Dialect without JDBC metadatamessage prefix. It describes the JDBC metadata failure and suggests checking the JDBC URL, credentials, driver, and database availability, or configuringspring.jpa.database-platformwhen appropriate. It does not infer a DataSource prefix or bean name, and it skips unrelated Hibernate, JDBC, and bean creation failures.The regression tests cover direct and nested cause chains, an actual JPA bootstrap failure with an unavailable DataSource, unrelated failures, and successful bootstrap when a dialect is configured.
Closes gh-1573
Verification
./gradlew :module:spring-boot-hibernate:check./gradlew checkgit diff --check