Skip to content

Commit 47c99d5

Browse files
committed
HHH-18538 fix startup logging for DatasourceConnectionProviderImpl and multi-tenant version
Signed-off-by: Gavin King <[email protected]>
1 parent 8aa37a9 commit 47c99d5

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/DatasourceConnectionProviderImpl.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,20 @@ public boolean supportsAggressiveRelease() {
139139
@Override
140140
public DatabaseConnectionInfo getDatabaseConnectionInfo(Dialect dialect) {
141141
return new DatabaseConnectionInfoImpl(
142-
"Connecting through datasource '" + (dataSourceJndiName != null ? dataSourceJndiName : dataSource) + "'",
142+
null,
143143
null,
144144
dialect.getVersion(),
145145
null,
146146
null,
147147
null,
148148
null
149-
);
149+
) {
150+
@Override
151+
public String toInfoString() {
152+
return dataSourceJndiName != null
153+
? "\tDatasource JND name [" + dataSourceJndiName + "]"
154+
: "\tProvided DataSource";
155+
}
156+
};
150157
}
151158
}

hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/spi/DataSourceBasedMultiTenantConnectionProviderImpl.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,19 @@ public void stop() {
125125
@Override
126126
public DatabaseConnectionInfo getDatabaseConnectionInfo(Dialect dialect) {
127127
return new DatabaseConnectionInfoImpl(
128-
"Multi-tenant - " + tenantIdentifierForAny,
128+
null,
129129
null,
130130
dialect.getVersion(),
131131
null,
132132
null,
133133
null,
134134
null
135-
);
135+
) {
136+
@Override
137+
public String toInfoString() {
138+
return "\tMulti-tenant datasource JNDI name [" + jndiName + ']';
139+
}
140+
};
136141
}
137142

138143
}

0 commit comments

Comments
 (0)