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>
|
* </ul>
|
||||||
* <p>
|
* <p>
|
||||||
* See section 8.2.1.9
|
* 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";
|
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.
|
* and {@link #JAKARTA_JDBC_USER} to specify how to connect to the database.
|
||||||
* <p>
|
* <p>
|
||||||
* See JPA 2 section 8.2.1.9
|
* 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";
|
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}.
|
* {@link org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl}.
|
||||||
* <p>
|
* <p>
|
||||||
* Possible values are enumerated by {@link java.sql.Connection}:
|
* 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}.
|
* {@code REPEATABLE_READ}, {@code SERIALIZABLE}.
|
||||||
* <p>
|
* <p>
|
||||||
* If this setting is not explicitly specified, Hibernate does not modify
|
* If this setting is not explicitly specified, Hibernate does not modify
|
||||||
* the transaction isolation level of the JDBC connection.
|
* the transaction isolation level of the JDBC connection.
|
||||||
|
*
|
||||||
|
* @see java.sql.Connection#setTransactionIsolation(int)
|
||||||
*/
|
*/
|
||||||
String ISOLATION = "hibernate.connection.isolation";
|
String ISOLATION = "hibernate.connection.isolation";
|
||||||
|
|
||||||
|
@ -270,6 +278,8 @@ public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSett
|
||||||
* including every built-in implementation 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}.
|
||||||
*
|
*
|
||||||
|
* @see java.sql.Connection#setAutoCommit(boolean)
|
||||||
|
*
|
||||||
* @settingDefault {@code false}
|
* @settingDefault {@code false}
|
||||||
*/
|
*/
|
||||||
String AUTOCOMMIT = "hibernate.connection.autocommit";
|
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}
|
* JDBC driver class name. This setting is ignored when Hibernate is configured
|
||||||
* connection.
|
* to obtain connections from a {@link javax.sql.DataSource}.
|
||||||
*
|
*
|
||||||
* @see #JDBC_DRIVER
|
* @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
|
* @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 #JDBC_USER
|
||||||
* @see #jdbcPassword
|
* @see #jdbcPassword
|
||||||
|
* @see java.sql.DriverManager#getConnection(String, String, String)
|
||||||
|
* @see javax.sql.DataSource#getConnection(String, String)
|
||||||
*/
|
*/
|
||||||
public HibernatePersistenceConfiguration jdbcUsername(String username) {
|
public HibernatePersistenceConfiguration jdbcUsername(String username) {
|
||||||
property( JDBC_USER, 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 #JDBC_PASSWORD
|
||||||
* @see #jdbcUsername
|
* @see #jdbcUsername
|
||||||
|
* @see java.sql.DriverManager#getConnection(String, String, String)
|
||||||
|
* @see javax.sql.DataSource#getConnection(String, String)
|
||||||
*/
|
*/
|
||||||
public HibernatePersistenceConfiguration jdbcPassword(String password) {
|
public HibernatePersistenceConfiguration jdbcPassword(String password) {
|
||||||
property( JDBC_PASSWORD, password );
|
property( JDBC_PASSWORD, password );
|
||||||
|
@ -142,13 +147,14 @@ public class HibernatePersistenceConfiguration extends PersistenceConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Username and password for non-{@link javax.sql.DataSource DataSource}
|
* Username and password for JDBC authentication.
|
||||||
* JDBC connection.
|
|
||||||
*
|
*
|
||||||
* @see #JDBC_USER
|
* @see #JDBC_USER
|
||||||
* @see #JDBC_PASSWORD
|
* @see #JDBC_PASSWORD
|
||||||
* @see #jdbcUsername
|
* @see #jdbcUsername
|
||||||
* @see #jdbcPassword
|
* @see #jdbcPassword
|
||||||
|
* @see java.sql.DriverManager#getConnection(String, String, String)
|
||||||
|
* @see javax.sql.DataSource#getConnection(String, String)
|
||||||
*/
|
*/
|
||||||
public HibernatePersistenceConfiguration jdbcCredentials(String username, String password) {
|
public HibernatePersistenceConfiguration jdbcCredentials(String username, String password) {
|
||||||
jdbcUsername( username );
|
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
|
* @see JdbcSettings#POOL_SIZE
|
||||||
*/
|
*/
|
||||||
|
@ -166,6 +173,36 @@ public class HibernatePersistenceConfiguration extends PersistenceConfiguration
|
||||||
return this;
|
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.
|
* Enables SQL logging to the console.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
Loading…
Reference in New Issue