improve jdoc for some JdbcSettings and deprecate one of them

This commit is contained in:
Gavin King 2024-12-10 15:56:16 +01:00
parent 87bab93d05
commit bb8aabbf0a
3 changed files with 28 additions and 15 deletions

View File

@ -50,7 +50,7 @@ import org.jboss.logging.Logger;
* <tr> * <tr>
* <td>{@value #CONNECTION_PROVIDER}</td> * <td>{@value #CONNECTION_PROVIDER}</td>
* <td>name of a {@link org.hibernate.engine.jdbc.connections.spi.ConnectionProvider} * <td>name of a {@link org.hibernate.engine.jdbc.connections.spi.ConnectionProvider}
* subclass (if not specified heuristics are used)</td> * subclass (if not specified, heuristics are used)</td>
* </tr> * </tr>
* <tr><td>{@value #USER}</td><td>database username</td></tr> * <tr><td>{@value #USER}</td><td>database username</td></tr>
* <tr><td>{@value #PASS}</td><td>database password</td></tr> * <tr><td>{@value #PASS}</td><td>database password</td></tr>

View File

@ -225,17 +225,17 @@ public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSett
String DIALECT_RESOLVERS = "hibernate.dialect_resolvers"; String DIALECT_RESOLVERS = "hibernate.dialect_resolvers";
/** /**
* Specifies a {@link ConnectionProvider} * Specifies a {@link ConnectionProvider} to use for obtaining JDBC connections,
* to use for obtaining JDBC connections, either: * either:
* <ul> * <ul>
* <li>an instance of {@code ConnectionProvider}, * <li>an instance of {@code ConnectionProvider},
* <li>a {@link Class} representing a class that implements * <li>a {@link Class} representing a class that implements
* {@code ConnectionProvider}, or * {@code ConnectionProvider}, or
* <li>the name of a class that implements {@code ConnectionProvider}. * <li>the name of a class that implements {@code ConnectionProvider}.
* </ul> * </ul>
* <p> *
* The term {@code "class"} appears in the setting name due to legacy reasons; * @apiNote The term {@code "class"} appears in the setting name due to legacy reasons;
* however it can accept instances. * however it can accept instances.
*/ */
String CONNECTION_PROVIDER = "hibernate.connection.provider_class"; String CONNECTION_PROVIDER = "hibernate.connection.provider_class";
@ -249,14 +249,24 @@ public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSett
String POOL_SIZE = "hibernate.connection.pool_size"; String POOL_SIZE = "hibernate.connection.pool_size";
/** /**
* Specified the JDBC transaction isolation level. * Specifies the JDBC transaction isolation level for connections obtained
* from any {@link ConnectionProvider} implementation which respects this
* setting, including every built-in implementation except for
* {@link org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl}.
* <p>
* Possible values are enumerated by {@link java.sql.Connection}:
* {@code NONE}, {@code READ_UNCOMMITTED}, {@code READ_COMMITTED},
* {@code REPEATABLE_READ}, {@code SERIALIZABLE}.
* <p>
* If this setting is not explicitly specified, Hibernate does not modify
* the transaction isolation level of the JDBC connection.
*/ */
String ISOLATION = "hibernate.connection.isolation"; String ISOLATION = "hibernate.connection.isolation";
/** /**
* Controls the autocommit mode of JDBC connections obtained from any * Controls the autocommit mode of JDBC connections obtained from any
* {@link ConnectionProvider} implementation which respects this setting, * {@link ConnectionProvider} implementation which respects this setting,
* which includes the built-in implementations do, except for * including every built-in implementation except for
* {@link org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl}. * {@link org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl}.
* *
* @settingDefault {@code false} * @settingDefault {@code false}
@ -264,16 +274,16 @@ public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSett
String AUTOCOMMIT = "hibernate.connection.autocommit"; String AUTOCOMMIT = "hibernate.connection.autocommit";
/** /**
* Indicates that Connections obtained from the configured {@link ConnectionProvider} have * Indicates that connections obtained from the configured {@link ConnectionProvider} have
* auto-commit already disabled when they are acquired. * auto-commit already disabled when they are acquired.
* <p> * <p>
* It is inappropriate to set this value to {@code true} when the Connections returned by * It is inappropriate to set this value to {@code true} when the connections returned by
* the provider do not, in fact, have auto-commit disabled. Doing so may lead to Hibernate * the provider do not, in fact, have auto-commit disabled. Doing so may lead to Hibernate
* executing SQL operations outside the scope of any transaction. * executing SQL operations outside the scope of any transaction.
* *
* @apiNote By default, Hibernate calls {@link java.sql.Connection#setAutoCommit(boolean)} on * @apiNote By default, Hibernate calls {@link java.sql.Connection#setAutoCommit(boolean)}
* newly-obtained connections. This setting allows to circumvent that call (as well as other * on newly-obtained connections. With this setting enabled, that call is skipped, along
* operations) in the interest of performance. * with some other operations, in the interest of performance.
* *
* @settingDefault {@code false} * @settingDefault {@code false}
* *
@ -289,7 +299,11 @@ public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSett
* <p> * <p>
* For example, declaring {@code hibernate.connection.foo=bar} tells Hibernate to * For example, declaring {@code hibernate.connection.foo=bar} tells Hibernate to
* append {@code foo=bar} to the JDBC connection URL. * append {@code foo=bar} to the JDBC connection URL.
*
* @deprecated This setting is only supported by {@code C3P0ConnectionProvider}
* and {@link org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl}.
*/ */
@Deprecated(since="7")
String CONNECTION_PREFIX = "hibernate.connection"; String CONNECTION_PREFIX = "hibernate.connection";
/** /**

View File

@ -178,7 +178,6 @@ public class DriverManagerConnectionProviderImpl
); );
return factory.create( return factory.create(
driver, driver,
serviceRegistry, serviceRegistry,
url, url,