Please add support for multitenancy in JdbcTemplate.
Scenario: i have an app which uses JPA for CRUD, but for reporting uses native queries executed via JdbcTemplate. Hibernate in our app is working in multitenancy mode with the strategy per schema on MySQL. I tried several things but could not implement similar multitenancy in JdbcTemplate.
Basiclly i do connection.createStatement("USE " + tenantSchema ); in hibernates multitenancyConnectionProvider.
I would like to do something similar in JdbcTemplate.
One thing to mention, JDBC connection has setCatalog method, which can be used to change schema/database, since each DB driver interpret it differently based on to their model, MySQL call SET <schema>, PostgreSQL changes DB etc. This will be more generic solution. Like Hibernate, if Spring has a way of defining ConnectionProvider and TenantResolver for JdbcTemplate, this should work. I assume some changes needed internally as well, since Spring wrap original connection for Transaction tracking etc.
So this is just ridiculous. Basically JdbcTemplate is hard coded to be single tenant. Because of this we do not even use it, but there is a catch ! Spring team uses it so we have to write ton of our own implementations already provided by spring to not use JdbcTemplate. geez