Created
August 8, 2017 17:29
-
-
Save gtudan/5ec63bc78500ae1bff612dca3e744162 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public Connection getConnection(String tenantIdentifier) throws SQLException { | |
log.debugf("Requesting connection for tenant %s", tenantIdentifier); | |
final Connection connection = getAnyConnection(); | |
connection.createStatement().execute("USE " + tenantIdentifier); | |
return connection; | |
} | |
@Override | |
public void releaseConnection(String tenantIdentifier, Connection connection) throws SQLException { | |
final String schema = configurationService.getSetting( | |
AvailableSettings.DEFAULT_SCHEMA, String.class, "public"); | |
selectConnectionProvider(tenantIdentifier).closeConnection(connection); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment