Description
Hibernate ORM allows starting up without access to the DB ("offline") by specifying hibernate.boot.allow_jdbc_metadata_access = false
. When using this setting, Hibernate ORM will not try to reach out to the DB on startup to determine the dialect/version. Instead, it will assume a dialect configured explicitly (e.g. inferred from jakarta.persistence.database-product-name
), and either a default version (minimum supported one) or an explicitly configured one (through jakarta.persistence.database-product-version
).
This feature is useful in particular for applications that start up before the DB becomes accessible. It can also be useful for Quarkus, where (part of) startup happens at build time.
When this feature is used, it can be useful to check the DB version matches the one that was explicitly configured. Quarkus executes such checks automatically.
However, in some cases, that DB version is not very easy to get, and might require vendor-specific "hacks". That's why Hibernate ORM 7+ exposes Dialect#determineDatabaseVersion
: it allows anyone to use the dialect of an already-started-up application to retrieve the version of the DB it's currently connected to, and then do any check they want.
We should check that these features work well in Hibernate Reactive. Copying org.hibernate.orm.test.boot.database.metadata.MetadataAccessTests
into the Reactive test suite might be enough for that.
Related: quarkusio/quarkus#43764