Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
3.3.3, 3.4.0
-
None
Description
We have a SpringBoot/SpringData application with Hibernate/JPA.
The application is "multi-tenant" and we are extending Hibernate's AbstractDataSourceBasedMultiTenantConnectionProviderImpl with corresponding TenantIdentifierResolver.
When a connection is requested we execute "USE
{schema}".
While testing, we discovered that requests that are meant for Tenant A were returning data for Tenant B. After much of hair pulling, we discovered that culprit seemed to have been "cachePrepStmts=true" included in connectionURL.
While it seems that removing this parameter from the URL defaults it to 'false' - our solution. looking at the code, it becomes obvious why we were failing.
It seems rather presumptious to cache results of the queries at the client-side.
We have Hibernate's session-level cache for that purpose.
At the very least current schema, should be taken into account.
We seem to be fine now with this option turned off.