File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
spring-orm-hibernate5/src/main/java/org/springframework/orm/hibernate5 Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 4343import org .hibernate .cfg .AvailableSettings ;
4444import org .hibernate .cfg .Configuration ;
4545import org .hibernate .cfg .Environment ;
46+ import org .hibernate .context .spi .CurrentTenantIdentifierResolver ;
4647import org .hibernate .engine .jdbc .connections .spi .MultiTenantConnectionProvider ;
4748import org .hibernate .engine .spi .SessionFactoryImplementor ;
4849
@@ -206,6 +207,17 @@ public LocalSessionFactoryBuilder setMultiTenantConnectionProvider(MultiTenantCo
206207 return this ;
207208 }
208209
210+ /**
211+ * Overridden to reliably pass a {@link CurrentTenantIdentifierResolver} to the SessionFactory.
212+ * @since 4.3.2
213+ * @see AvailableSettings#MULTI_TENANT_IDENTIFIER_RESOLVER
214+ */
215+ @ Override
216+ public void setCurrentTenantIdentifierResolver (CurrentTenantIdentifierResolver currentTenantIdentifierResolver ) {
217+ getProperties ().put (AvailableSettings .MULTI_TENANT_IDENTIFIER_RESOLVER , currentTenantIdentifierResolver );
218+ super .setCurrentTenantIdentifierResolver (currentTenantIdentifierResolver );
219+ }
220+
209221 /**
210222 * Specify custom type filters for Spring-based scanning for entity classes.
211223 * <p>Default is to search all specified packages for classes annotated with
You can’t perform that action at this time.
0 commit comments