Skip to content

Commit bb8aabb

Browse files
committed
improve jdoc for some JdbcSettings and deprecate one of them
1 parent 87bab93 commit bb8aabb

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

hibernate-core/src/main/java/org/hibernate/cfg/Environment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* <tr>
5151
* <td>{@value #CONNECTION_PROVIDER}</td>
5252
* <td>name of a {@link org.hibernate.engine.jdbc.connections.spi.ConnectionProvider}
53-
* subclass (if not specified heuristics are used)</td>
53+
* subclass (if not specified, heuristics are used)</td>
5454
* </tr>
5555
* <tr><td>{@value #USER}</td><td>database username</td></tr>
5656
* <tr><td>{@value #PASS}</td><td>database password</td></tr>

hibernate-core/src/main/java/org/hibernate/cfg/JdbcSettings.java

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -225,17 +225,17 @@ public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSett
225225
String DIALECT_RESOLVERS = "hibernate.dialect_resolvers";
226226

227227
/**
228-
* Specifies a {@link ConnectionProvider}
229-
* to use for obtaining JDBC connections, either:
228+
* Specifies a {@link ConnectionProvider} to use for obtaining JDBC connections,
229+
* either:
230230
* <ul>
231231
* <li>an instance of {@code ConnectionProvider},
232232
* <li>a {@link Class} representing a class that implements
233233
* {@code ConnectionProvider}, or
234234
* <li>the name of a class that implements {@code ConnectionProvider}.
235235
* </ul>
236-
* <p>
237-
* The term {@code "class"} appears in the setting name due to legacy reasons;
238-
* however it can accept instances.
236+
*
237+
* @apiNote The term {@code "class"} appears in the setting name due to legacy reasons;
238+
* however it can accept instances.
239239
*/
240240
String CONNECTION_PROVIDER = "hibernate.connection.provider_class";
241241

@@ -249,31 +249,41 @@ public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSett
249249
String POOL_SIZE = "hibernate.connection.pool_size";
250250

251251
/**
252-
* Specified the JDBC transaction isolation level.
252+
* Specifies the JDBC transaction isolation level for connections obtained
253+
* from any {@link ConnectionProvider} implementation which respects this
254+
* setting, including every built-in implementation except for
255+
* {@link org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl}.
256+
* <p>
257+
* Possible values are enumerated by {@link java.sql.Connection}:
258+
* {@code NONE}, {@code READ_UNCOMMITTED}, {@code READ_COMMITTED},
259+
* {@code REPEATABLE_READ}, {@code SERIALIZABLE}.
260+
* <p>
261+
* If this setting is not explicitly specified, Hibernate does not modify
262+
* the transaction isolation level of the JDBC connection.
253263
*/
254264
String ISOLATION = "hibernate.connection.isolation";
255265

256266
/**
257267
* Controls the autocommit mode of JDBC connections obtained from any
258268
* {@link ConnectionProvider} implementation which respects this setting,
259-
* which includes the built-in implementations do, except for
269+
* including every built-in implementation except for
260270
* {@link org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl}.
261271
*
262272
* @settingDefault {@code false}
263273
*/
264274
String AUTOCOMMIT = "hibernate.connection.autocommit";
265275

266276
/**
267-
* Indicates that Connections obtained from the configured {@link ConnectionProvider} have
277+
* Indicates that connections obtained from the configured {@link ConnectionProvider} have
268278
* auto-commit already disabled when they are acquired.
269279
* <p>
270-
* It is inappropriate to set this value to {@code true} when the Connections returned by
271-
* the provider do not, in fact, have auto-commit disabled. Doing so may lead to Hibernate
280+
* It is inappropriate to set this value to {@code true} when the connections returned by
281+
* the provider do not, in fact, have auto-commit disabled. Doing so may lead to Hibernate
272282
* executing SQL operations outside the scope of any transaction.
273283
*
274-
* @apiNote By default, Hibernate calls {@link java.sql.Connection#setAutoCommit(boolean)} on
275-
* newly-obtained connections. This setting allows to circumvent that call (as well as other
276-
* operations) in the interest of performance.
284+
* @apiNote By default, Hibernate calls {@link java.sql.Connection#setAutoCommit(boolean)}
285+
* on newly-obtained connections. With this setting enabled, that call is skipped, along
286+
* with some other operations, in the interest of performance.
277287
*
278288
* @settingDefault {@code false}
279289
*
@@ -289,7 +299,11 @@ public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSett
289299
* <p>
290300
* For example, declaring {@code hibernate.connection.foo=bar} tells Hibernate to
291301
* append {@code foo=bar} to the JDBC connection URL.
302+
*
303+
* @deprecated This setting is only supported by {@code C3P0ConnectionProvider}
304+
* and {@link org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl}.
292305
*/
306+
@Deprecated(since="7")
293307
String CONNECTION_PREFIX = "hibernate.connection";
294308

295309
/**

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ else if ( connectionCreatorFactory != null ) {
178178
);
179179

180180
return factory.create(
181-
182181
driver,
183182
serviceRegistry,
184183
url,

0 commit comments

Comments
 (0)