File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
hibernate-core/src/main/java/org/hibernate/internal Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -716,17 +716,20 @@ private String tenantSchema() {
716
716
return tenantSchemaMapper == null ? null : tenantSchemaMapper .schemaName ( tenantIdentifier );
717
717
}
718
718
719
+ private transient String initialSchema ;
720
+
719
721
@ Override
720
722
public void afterObtainConnection (Connection connection ) throws SQLException {
721
723
if ( useSchemaBasedMultiTenancy () ) {
724
+ initialSchema = connection .getSchema ();
722
725
connection .setSchema ( tenantSchema () );
723
726
}
724
727
}
725
728
726
729
@ Override
727
730
public void beforeReleaseConnection (Connection connection ) throws SQLException {
728
731
if ( useSchemaBasedMultiTenancy () ) {
729
- connection .setSchema ( null );
732
+ connection .setSchema ( initialSchema );
730
733
}
731
734
}
732
735
You can’t perform that action at this time.
0 commit comments