add two additional convenience methods to HibernatePersistenceConfiguration
improve some jdoc
This commit is contained in:
parent
aa26709cda
commit
9dcae54dd7
|
@ -105,6 +105,9 @@ public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSett
|
|||
* </ul>
|
||||
* <p>
|
||||
* See section 8.2.1.9
|
||||
*
|
||||
* @see java.sql.DriverManager#getConnection(String, String, String)
|
||||
* @see javax.sql.DataSource#getConnection(String, String)
|
||||
*/
|
||||
String JAKARTA_JDBC_USER = "jakarta.persistence.jdbc.user";
|
||||
|
||||
|
@ -115,6 +118,9 @@ public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSett
|
|||
* and {@link #JAKARTA_JDBC_USER} to specify how to connect to the database.
|
||||
* <p>
|
||||
* See JPA 2 section 8.2.1.9
|
||||
*
|
||||
* @see java.sql.DriverManager#getConnection(String, String, String)
|
||||
* @see javax.sql.DataSource#getConnection(String, String)
|
||||
*/
|
||||
String JAKARTA_JDBC_PASSWORD = "jakarta.persistence.jdbc.password";
|
||||
|
||||
|
@ -256,11 +262,13 @@ public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSett
|
|||
* {@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 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.
|
||||
*
|
||||
* @see java.sql.Connection#setTransactionIsolation(int)
|
||||
*/
|
||||
String ISOLATION = "hibernate.connection.isolation";
|
||||
|
||||
|
@ -270,6 +278,8 @@ public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSett
|
|||
* including every built-in implementation except for
|
||||
* {@link org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl}.
|
||||
*
|
||||
* @see java.sql.Connection#setAutoCommit(boolean)
|
||||
*
|
||||
* @settingDefault {@code false}
|
||||
*/
|
||||
String AUTOCOMMIT = "hibernate.connection.autocommit";
|
||||
|
|
|
@ -99,8 +99,8 @@ public class HibernatePersistenceConfiguration extends PersistenceConfiguration
|
|||
}
|
||||
|
||||
/**
|
||||
* JDBC driver class name for non-{@link javax.sql.DataSource DataSource}
|
||||
* connection.
|
||||
* JDBC driver class name. This setting is ignored when Hibernate is configured
|
||||
* to obtain connections from a {@link javax.sql.DataSource}.
|
||||
*
|
||||
* @see #JDBC_DRIVER
|
||||
*/
|
||||
|
@ -110,7 +110,8 @@ public class HibernatePersistenceConfiguration extends PersistenceConfiguration
|
|||
}
|
||||
|
||||
/**
|
||||
* JDBC URL of non-{@link javax.sql.DataSource DataSource} JDBC connection.
|
||||
* JDBC URL. This setting is ignored when Hibernate is configured to obtain
|
||||
* connections from a {@link javax.sql.DataSource}.
|
||||
*
|
||||
* @see #JDBC_URL
|
||||
*/
|
||||
|
@ -120,10 +121,12 @@ public class HibernatePersistenceConfiguration extends PersistenceConfiguration
|
|||
}
|
||||
|
||||
/**
|
||||
* Username for non-{@link javax.sql.DataSource DataSource} JDBC connection.
|
||||
* Username for JDBC authentication.
|
||||
*
|
||||
* @see #JDBC_USER
|
||||
* @see #jdbcPassword
|
||||
* @see java.sql.DriverManager#getConnection(String, String, String)
|
||||
* @see javax.sql.DataSource#getConnection(String, String)
|
||||
*/
|
||||
public HibernatePersistenceConfiguration jdbcUsername(String username) {
|
||||
property( JDBC_USER, username );
|
||||
|
@ -131,10 +134,12 @@ public class HibernatePersistenceConfiguration extends PersistenceConfiguration
|
|||
}
|
||||
|
||||
/**
|
||||
* Password for non-{@link javax.sql.DataSource DataSource} JDBC connection.
|
||||
* Password for JDBC authentication.
|
||||
*
|
||||
* @see #JDBC_PASSWORD
|
||||
* @see #jdbcUsername
|
||||
* @see java.sql.DriverManager#getConnection(String, String, String)
|
||||
* @see javax.sql.DataSource#getConnection(String, String)
|
||||
*/
|
||||
public HibernatePersistenceConfiguration jdbcPassword(String password) {
|
||||
property( JDBC_PASSWORD, password );
|
||||
|
@ -142,13 +147,14 @@ public class HibernatePersistenceConfiguration extends PersistenceConfiguration
|
|||
}
|
||||
|
||||
/**
|
||||
* Username and password for non-{@link javax.sql.DataSource DataSource}
|
||||
* JDBC connection.
|
||||
* Username and password for JDBC authentication.
|
||||
*
|
||||
* @see #JDBC_USER
|
||||
* @see #JDBC_PASSWORD
|
||||
* @see #jdbcUsername
|
||||
* @see #jdbcPassword
|
||||
* @see java.sql.DriverManager#getConnection(String, String, String)
|
||||
* @see javax.sql.DataSource#getConnection(String, String)
|
||||
*/
|
||||
public HibernatePersistenceConfiguration jdbcCredentials(String username, String password) {
|
||||
jdbcUsername( username );
|
||||
|
@ -157,7 +163,8 @@ public class HibernatePersistenceConfiguration extends PersistenceConfiguration
|
|||
}
|
||||
|
||||
/**
|
||||
* The JDBC connection pool size.
|
||||
* The JDBC connection pool size. This setting is ignored when Hibernate is
|
||||
* configured to obtain connections from a {@link javax.sql.DataSource}.
|
||||
*
|
||||
* @see JdbcSettings#POOL_SIZE
|
||||
*/
|
||||
|
@ -166,6 +173,36 @@ public class HibernatePersistenceConfiguration extends PersistenceConfiguration
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The JDBC {@linkplain java.sql.Connection#setAutoCommit autocommit mode}
|
||||
* for pooled connections. This setting is ignored when Hibernate is
|
||||
* configured to obtain connections from a {@link javax.sql.DataSource}.
|
||||
*
|
||||
* @see JdbcSettings#AUTOCOMMIT
|
||||
*/
|
||||
public HibernatePersistenceConfiguration jdbcAutocommit(boolean autocommit) {
|
||||
property( JdbcSettings.AUTOCOMMIT, autocommit );
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The JDBC {@linkplain java.sql.Connection#setTransactionIsolation transaction
|
||||
* isolation level}. This setting is ignored when Hibernate is configured to
|
||||
* obtain connections from a {@link javax.sql.DataSource}.
|
||||
* <p>
|
||||
* Possible values are enumerated by {@link java.sql.Connection}:
|
||||
* {@link java.sql.Connection#TRANSACTION_READ_UNCOMMITTED},
|
||||
* {@link java.sql.Connection#TRANSACTION_READ_COMMITTED},
|
||||
* {@link java.sql.Connection#TRANSACTION_REPEATABLE_READ}, and
|
||||
* {@link java.sql.Connection#TRANSACTION_SERIALIZABLE}.
|
||||
*
|
||||
* @see JdbcSettings#ISOLATION
|
||||
*/
|
||||
public HibernatePersistenceConfiguration jdbcTransactionIsolation(int isolationLevel) {
|
||||
property( JdbcSettings.ISOLATION, isolationLevel );
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables SQL logging to the console.
|
||||
* <p>
|
||||
|
|
Loading…
Reference in New Issue