File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
spring-orm/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 43
43
import org .hibernate .cfg .AvailableSettings ;
44
44
import org .hibernate .cfg .Configuration ;
45
45
import org .hibernate .cfg .Environment ;
46
+ import org .hibernate .context .spi .CurrentTenantIdentifierResolver ;
46
47
import org .hibernate .engine .jdbc .connections .spi .MultiTenantConnectionProvider ;
47
48
import org .hibernate .engine .spi .SessionFactoryImplementor ;
48
49
@@ -206,6 +207,17 @@ public LocalSessionFactoryBuilder setMultiTenantConnectionProvider(MultiTenantCo
206
207
return this ;
207
208
}
208
209
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
+
209
221
/**
210
222
* Specify custom type filters for Spring-based scanning for entity classes.
211
223
* <p>Default is to search all specified packages for classes annotated with
You can’t perform that action at this time.
0 commit comments