Hello; I saw the DialectResolutionInfoSource SPI interface and (incorrectly, it turns out) assumed I could provide an implementation via ServiceLoader. When that didn’t work, I dug through the Hibernate source code and discovered that it is only really used via the DialectFactory#buildDialect method, and the only class that actually calls that method is the JdbcEnvironmentInitiator, and it only calls that method with either null or a memoized supplier (() -> dialectResolutionInfo).
The combination of all of this surprised me: are there perhaps future plans to make DialectResolutionInfoSource a true SPI that an external user can implement and place somewhere appropriate such that it is used by Hibernate?
An SPI does not automatically mean that you can provide an implementation for this via the ServiceLoader mechanism. It simply means that the types are implementable by users for integration purposes. You can configure the database name and version through setting configuration properties though:
jakarta.persistence.database-product-name
jakarta.persistence.database-product-version
or individual settings for major/minor parts of the verison
OK, thanks. And to confirm: if I implement DialectResolutionInfoSource myself, there is, in fact, no way to have Hibernate somehow know about or use my implementation somewhere, like in a call to DialectFactory#buildDialect(Map, DialectResolutionInfoSource)? So in that sense, given that it is only used by DialectFactory implementations, it is really conceptually like a nested interface of DialectFactory, for use only by DialectFactory implementations?
if I implement DialectResolutionInfoSource myself, there is, in fact, no way to have Hibernate somehow know about or use my implementation somewhere, like in a call to DialectFactory#buildDialect(Map, DialectResolutionInfoSource) ?
Correct, there is no way to do that.
So in that sense, given that it is only used by DialectFactory implementations, it is really conceptually like a nested interface of DialectFactory , for use only by DialectFactory implementations?
I guess at this point DialectResolutionInfoSource is obsolete and we could pass DialectResolutionInfo around directly, but either way, it is what it is. You can’t replace implementations of that.