One hard requirement of the application I am working on is to support multiple backends in production - Postgres, SQL Server, etc.
Quarkus locks certain built-in datasource configuration at build time, so that end user applications cannot override things such as db-kind/jdbc.driver, etc. Are there any options for me to be able to support multiple backends? I'm even open to providing my own custom Hibernate session if I have to.
As @Ladicek pointed out, the usual solution to this problem is configuring one datasource for each database vendor you support, disabling them all by default, and letting the user activate the right one with runtime properties/profiles. You can also add some CDI magic to have the default datasource transparently point to the selected one (though that won't be enough for e.g. Hibernate ORM).
The whole solution is descibed at http://quarkus.io/guides/datasource#datasource-active. If using Hibernate ORM you'll need to do the same with persistence units: https://quarkus.io/guides/hibernate-orm#persistence-unit-active
If that doesn't work, you'll need to edit your question to provide your exact configuration (application.properties
), the stacktrace, and the code of the relevant injection point, so we can help you debug that.
Note while this is by far the most straightforward solution, there is another reasonable one: reaugmentation. But that's much more cumbersome: each user will basically have to go through a "second build" process to produce the final executable/container, or (worse) have that process run on application startup.
Making this easier in Quarkus -- while preserving optimizations that make Quarkus what it is -- has been suggested (see https://github.com/quarkusio/quarkus/issues/43656), but so far nobody took up that task. It's complicated.