I have a spring application with 2 databases - PostgreSQL & Oracle. The default schema of the 1-st DB specified in application.properties file (and may be overridden in command line) by the “spring.jpa.properties.hibernate.default_schema” parameter. There is also a DbConfig module where necessary beans are configured for db access.
But when I created an immutable entity with @Subselect query, I found that data provided by the subquery are from the default “public” schema. I tried to use a {h-schema} placeholder with table names but got a SQL error. So now I have to use a hardcoded schema name if it is not “public”.
I guess that the same thing is with a @JoinFormula annotation queries but didn’t check it yet.
Is there a solution or workaround for my problem?
I use Hibernate version 5.4.15.
Hibernate apparently does not do the substitution everywhere you are expecting it should.
The solution for this is that you create a JIRA issue for this feature request and a PR with a test case and the implementation for it