Introduce internal init_sql config and by default enable ansinull for Sybase ASE

This commit is contained in:
Christian Beikov 2021-09-02 13:08:58 +02:00
parent 9e4e9ce0d5
commit dd6efa509b
40 changed files with 288 additions and 139 deletions

View File

@ -10,6 +10,7 @@ hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
hibernate.connection.pool_size 5

View File

@ -18,20 +18,23 @@ ext {
'jdbc.user' : 'sa',
'jdbc.pass' : '',
'jdbc.url' : 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000',
'connection.init_sql' : ''
],
hsqldb : [
'db.dialect' : 'org.hibernate.dialect.HSQLDialect',
'jdbc.driver': 'org.hsqldb.jdbc.JDBCDriver',
'jdbc.user' : 'sa',
'jdbc.pass' : '',
'jdbc.url' : 'jdbc:hsqldb:mem:test'
'jdbc.url' : 'jdbc:hsqldb:mem:test',
'connection.init_sql' : ''
],
derby : [
'db.dialect' : 'org.hibernate.dialect.DerbyDialect',
'jdbc.driver': 'org.apache.derby.jdbc.EmbeddedDriver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:derby:target/tmp/derby/hibernate_orm_test;databaseName=hibernate_orm_test;create=true'
'jdbc.url' : 'jdbc:derby:target/tmp/derby/hibernate_orm_test;databaseName=hibernate_orm_test;create=true',
'connection.init_sql' : ''
],
pgsql : [
'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect',
@ -39,7 +42,8 @@ ext {
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0'
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0',
'connection.init_sql' : ''
],
pgsql_docker : [
'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect',
@ -47,7 +51,8 @@ ext {
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0'
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0',
'connection.init_sql' : ''
],
pgsql_ci : [
'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect',
@ -55,7 +60,8 @@ ext {
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0'
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0',
'connection.init_sql' : ''
],
edb_ci : [
'db.dialect' : 'org.hibernate.dialect.PostgresPlusDialect',
@ -63,7 +69,8 @@ ext {
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0'
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0',
'connection.init_sql' : ''
],
sybase_ci : [
'db.dialect' : 'org.hibernate.dialect.SybaseASEDialect',
@ -71,28 +78,41 @@ ext {
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
// Disable prepared statement caching to avoid issues with changing schemas
'jdbc.url' : 'jdbc:jtds:sybase://' + dbHost + ':5000/hibernate_orm_test;maxStatements=0;cacheMetaData=false'
'jdbc.url' : 'jdbc:jtds:sybase://' + dbHost + ':5000/hibernate_orm_test;maxStatements=0;cacheMetaData=false',
'connection.init_sql' : 'set ansinull on'
],
sybase_ci_legacynull : [
'db.dialect' : 'org.hibernate.dialect.SybaseASEDialect',
'jdbc.driver': 'net.sourceforge.jtds.jdbc.Driver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
// Disable prepared statement caching to avoid issues with changing schemas
'jdbc.url' : 'jdbc:jtds:sybase://' + dbHost + ':5000/hibernate_orm_test;maxStatements=0;cacheMetaData=false',
'connection.init_sql' : ''
],
mysql : [
'db.dialect' : 'org.hibernate.dialect.MySQLDialect',
'jdbc.driver': 'com.mysql.cj.jdbc.Driver',
'jdbc.user' : 'hibernateormtest',
'jdbc.pass' : 'hibernateormtest',
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test'
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test',
'connection.init_sql' : ''
],
mysql_docker : [
'db.dialect' : 'org.hibernate.dialect.MySQLDialect',
'jdbc.driver': 'com.mysql.cj.jdbc.Driver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test?allowPublicKeyRetrieval=true'
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test?allowPublicKeyRetrieval=true',
'connection.init_sql' : ''
],
mysql_ci : [
'db.dialect' : 'org.hibernate.dialect.MySQLDialect',
'jdbc.driver': 'com.mysql.cj.jdbc.Driver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test?allowPublicKeyRetrieval=true'
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test?allowPublicKeyRetrieval=true',
'connection.init_sql' : ''
],
// uses docker mysql_8_0
mysql8_spatial_ci: [
@ -100,28 +120,32 @@ ext {
'jdbc.driver': 'com.mysql.cj.jdbc.Driver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test?allowPublicKeyRetrieval=true'
'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test?allowPublicKeyRetrieval=true',
'connection.init_sql' : ''
],
mariadb : [
'db.dialect' : 'org.hibernate.dialect.MariaDBDialect',
'jdbc.driver': 'org.mariadb.jdbc.Driver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test'
'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test',
'connection.init_sql' : ''
],
mariadb_ci : [
'db.dialect' : 'org.hibernate.dialect.MariaDBDialect',
'jdbc.driver': 'org.mariadb.jdbc.Driver',
'jdbc.user' : 'root',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test'
'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test',
'connection.init_sql' : ''
],
mariadb_spatial_ci : [
'db.dialect' : 'org.hibernate.spatial.dialect.mariadb.MariaDB103SpatialDialect',
'jdbc.driver': 'org.mariadb.jdbc.Driver',
'jdbc.user' : 'root',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test'
'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test',
'connection.init_sql' : ''
],
postgis : [
'db.dialect' : 'org.hibernate.spatial.dialect.postgis.PostgisPG95Dialect',
@ -129,28 +153,32 @@ ext {
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0'
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0',
'connection.init_sql' : ''
],
oracle : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/xe'
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/xe',
'connection.init_sql' : ''
],
oracle_jenkins : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:oracle:thin:@hibernate-testing-oracle-se.ccuzkqo3zqzq.us-east-1.rds.amazonaws.com:1521:ORCL'
'jdbc.url' : 'jdbc:oracle:thin:@hibernate-testing-oracle-se.ccuzkqo3zqzq.us-east-1.rds.amazonaws.com:1521:ORCL',
'connection.init_sql' : ''
],
oracle_rds : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:oracle:thin:@localhost:1521:ORCL'
'jdbc.url' : 'jdbc:oracle:thin:@localhost:1521:ORCL',
'connection.init_sql' : ''
],
// Use ./docker_db.sh oracle_ee to start the database
oracle_docker : [
@ -158,70 +186,80 @@ ext {
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'c##hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/ORCLPDB1.localdomain'
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/ORCLPDB1.localdomain',
'connection.init_sql' : ''
],
oracle_ci : [
'db.dialect' : 'org.hibernate.dialect.OracleDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'SYSTEM',
'jdbc.pass' : 'Oracle18',
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521:XE'
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521:XE',
'connection.init_sql' : ''
],
oracle_spatial_ci : [
'db.dialect' : 'org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect',
'jdbc.driver': 'oracle.jdbc.OracleDriver',
'jdbc.user' : 'SYSTEM',
'jdbc.pass' : 'Oracle18',
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521:XE'
'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521:XE',
'connection.init_sql' : ''
],
mssql : [
'db.dialect' : 'org.hibernate.dialect.SQLServerDialect',
'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';instance=SQLEXPRESS;databaseName=hibernate_orm_test'
'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';instance=SQLEXPRESS;databaseName=hibernate_orm_test',
'connection.init_sql' : ''
],
mssql_ci : [
'db.dialect' : 'org.hibernate.dialect.SQLServerDialect',
'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
'jdbc.user' : 'sa',
'jdbc.pass' : 'Hibernate_orm_test',
'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';databaseName=hibernate_orm_test'
'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';databaseName=hibernate_orm_test',
'connection.init_sql' : ''
],
mssql_spatial_ci : [
'db.dialect' : 'org.hibernate.spatial.dialect.sqlserver.SqlServer2012SpatialDialect',
'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
'jdbc.user' : 'sa',
'jdbc.pass' : 'Hibernate_orm_test',
'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';databaseName=hibernate_orm_test'
'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';databaseName=hibernate_orm_test',
'connection.init_sql' : ''
],
informix : [
'db.dialect' : 'org.hibernate.dialect.InformixDialect',
'jdbc.driver': 'com.informix.jdbc.IfxDriver',
'jdbc.user' : 'informix',
'jdbc.pass' : 'in4mix',
'jdbc.url' : 'jdbc:informix-sqli://' + dbHost + ':9088/sysuser:INFORMIXSERVER=dev;user=informix;password=in4mix'
'jdbc.url' : 'jdbc:informix-sqli://' + dbHost + ':9088/sysuser:INFORMIXSERVER=dev;user=informix;password=in4mix',
'connection.init_sql' : ''
],
db2 : [
'db.dialect' : 'org.hibernate.dialect.DB2Dialect',
'jdbc.driver': 'com.ibm.db2.jcc.DB2Driver',
'jdbc.user' : 'db2inst1',
'jdbc.pass' : 'db2inst1-pwd',
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/hibern8'
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/hibern8',
'connection.init_sql' : ''
],
db2_ci : [
'db.dialect' : 'org.hibernate.dialect.DB2Dialect',
'jdbc.driver': 'com.ibm.db2.jcc.DB2Driver',
'jdbc.user' : 'orm_test',
'jdbc.pass' : 'orm_test',
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test'
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test',
'connection.init_sql' : ''
],
db2_spatial_ci : [
'db.dialect' : 'org.hibernate.spatial.dialect.db2.DB2SpatialDialect',
'jdbc.driver': 'com.ibm.db2.jcc.DB2Driver',
'jdbc.user' : 'orm_test',
'jdbc.pass' : 'orm_test',
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test'
'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test',
'connection.init_sql' : ''
],
hana : [
'db.dialect' : 'org.hibernate.dialect.HANAColumnStoreDialect',
@ -229,7 +267,8 @@ ext {
'jdbc.user' : 'HIBERNATE_TEST',
'jdbc.pass' : 'H1bernate_test',
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
'jdbc.url' : 'jdbc:sap://' + dbHost + ':30015/?statementCacheSize=0'
'jdbc.url' : 'jdbc:sap://' + dbHost + ':30015/?statementCacheSize=0',
'connection.init_sql' : ''
],
hana_cloud : [
'db.dialect' : 'org.hibernate.dialect.HANACloudColumnStoreDialect',
@ -237,7 +276,8 @@ ext {
'jdbc.user' : 'HIBERNATE_TEST',
'jdbc.pass' : 'H1bernate_test',
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
'jdbc.url' : 'jdbc:sap://' + dbHost + ':443/?encrypt=true&validateCertificate=false&statementCacheSize=0'
'jdbc.url' : 'jdbc:sap://' + dbHost + ':443/?encrypt=true&validateCertificate=false&statementCacheSize=0',
'connection.init_sql' : ''
],
hana_jenkins : [
'db.dialect' : 'org.hibernate.dialect.HANAColumnStoreDialect',
@ -245,7 +285,8 @@ ext {
'jdbc.user' : 'HIBERNATE_TEST',
'jdbc.pass' : 'H1bernate_test',
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
'jdbc.url' : 'jdbc:sap://' + dbHost + ':39015/?statementCacheSize=0'
'jdbc.url' : 'jdbc:sap://' + dbHost + ':39015/?statementCacheSize=0',
'connection.init_sql' : ''
],
hana_docker : [
'db.dialect' : 'org.hibernate.dialect.HANAColumnStoreDialect',
@ -253,7 +294,8 @@ ext {
'jdbc.user' : 'SYSTEM',
'jdbc.pass' : 'H1bernate_test',
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
'jdbc.url' : 'jdbc:sap://' + dbHost + ':39017/?statementCacheSize=0'
'jdbc.url' : 'jdbc:sap://' + dbHost + ':39017/?statementCacheSize=0',
'connection.init_sql' : ''
],
hana_ci : [
'db.dialect' : 'org.hibernate.dialect.HANAColumnStoreDialect',
@ -261,7 +303,8 @@ ext {
'jdbc.user' : 'SYSTEM',
'jdbc.pass' : 'H1bernate_test',
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
'jdbc.url' : 'jdbc:sap://' + dbHost + ':39017/?statementCacheSize=0'
'jdbc.url' : 'jdbc:sap://' + dbHost + ':39017/?statementCacheSize=0',
'connection.init_sql' : ''
],
hana_spatial_ci : [
'db.dialect' : 'org.hibernate.spatial.dialect.hana.HANASpatialDialect',
@ -269,7 +312,8 @@ ext {
'jdbc.user' : 'SYSTEM',
'jdbc.pass' : 'H1bernate_test',
// Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html
'jdbc.url' : 'jdbc:sap://' + dbHost + ':39017/?statementCacheSize=0'
'jdbc.url' : 'jdbc:sap://' + dbHost + ':39017/?statementCacheSize=0',
'connection.init_sql' : ''
],
cockroachdb : [
'db.dialect' : 'org.hibernate.dialect.CockroachDialect',
@ -278,7 +322,8 @@ ext {
'jdbc.user' : 'root',
'jdbc.pass' : '',
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
'jdbc.url' : 'jdbc:postgresql://' + dbHost + ':26257/defaultdb?sslmode=disable&preparedStatementCacheQueries=0'
'jdbc.url' : 'jdbc:postgresql://' + dbHost + ':26257/defaultdb?sslmode=disable&preparedStatementCacheQueries=0',
'connection.init_sql' : ''
],
cockroachdb_spatial : [
'db.dialect' : 'org.hibernate.spatial.dialect.cockroachdb.CockroachDB202SpatialDialect',
@ -287,7 +332,8 @@ ext {
'jdbc.user' : 'root',
'jdbc.pass' : '',
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
'jdbc.url' : 'jdbc:postgresql://'+ dbHost +'localhost:26257/defaultdb?sslmode=disable&preparedStatementCacheQueries=0'
'jdbc.url' : 'jdbc:postgresql://'+ dbHost +'localhost:26257/defaultdb?sslmode=disable&preparedStatementCacheQueries=0',
'connection.init_sql' : ''
],
firebird : [
'db.dialect' : 'org.hibernate.dialect.FirebirdDialect',
@ -297,7 +343,8 @@ ext {
// Overriding default transaction definition (5 seconds instead of infinite wait) to prevent problems in test cleanup
// Expects alias 'hibernate_orm_test' in aliases.conf (FB2.5 and earlier) or databases.conf (FB3.0 and later)
// Created database must either use default character set NONE, or UTF8 with page size 16384 or higher (to prevent issues with indexes due to keysize)
'jdbc.url' : 'jdbc:firebirdsql://' + dbHost +'localhost/hibernate_orm_test?charSet=utf-8;TRANSACTION_READ_COMMITTED=read_committed,rec_version,wait,lock_timeout=5'
'jdbc.url' : 'jdbc:firebirdsql://' + dbHost +'localhost/hibernate_orm_test?charSet=utf-8;TRANSACTION_READ_COMMITTED=read_committed,rec_version,wait,lock_timeout=5',
'connection.init_sql' : ''
],
]
}

View File

@ -9,6 +9,7 @@ hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
hibernate.jdbc.batch_size 10
hibernate.connection.provider_class AgroalConnectionProvider

View File

@ -9,6 +9,7 @@ hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
hibernate.connection.pool_size 5
hibernate.c3p0.min_size 50

View File

@ -8,6 +8,7 @@ package org.hibernate.engine.jdbc.connections.internal;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
import org.hibernate.HibernateException;
@ -33,18 +34,21 @@ public abstract class BasicConnectionCreator implements ConnectionCreator {
private final boolean autoCommit;
private final Integer isolation;
private final String initSql;
public BasicConnectionCreator(
ServiceRegistryImplementor serviceRegistry,
String url,
Properties connectionProps,
boolean autocommit,
Integer isolation) {
Integer isolation,
String initSql) {
this.serviceRegistry = serviceRegistry;
this.url = url;
this.connectionProps = connectionProps;
this.autoCommit = autocommit;
this.isolation = isolation;
this.initSql = initSql;
}
@Override
@ -77,6 +81,15 @@ public abstract class BasicConnectionCreator implements ConnectionCreator {
throw convertSqlException( "Unable to set auto-commit (" + autoCommit + ")", e );
}
if ( initSql != null && !initSql.trim().isEmpty() ) {
try (Statement s = conn.createStatement()) {
s.execute( initSql );
}
catch (SQLException e) {
throw convertSqlException( "Unable to execute initSql (" + initSql + ")", e );
}
}
return conn;
}

View File

@ -1,62 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.engine.jdbc.connections.internal;
import java.sql.Driver;
import java.util.Properties;
import org.hibernate.service.spi.ServiceRegistryImplementor;
/**
* A builder for ConnectionCreator instances
*
* @author Steve Ebersole
*/
public class ConnectionCreatorBuilder {
private final ServiceRegistryImplementor serviceRegistry;
private Driver driver;
private String url;
private Properties connectionProps;
private boolean autoCommit;
private Integer isolation;
public ConnectionCreatorBuilder(ServiceRegistryImplementor serviceRegistry) {
this.serviceRegistry = serviceRegistry;
}
public void setDriver(Driver driver) {
this.driver = driver;
}
public void setUrl(String url) {
this.url = url;
}
public void setConnectionProps(Properties connectionProps) {
this.connectionProps = connectionProps;
}
public void setAutoCommit(boolean autoCommit) {
this.autoCommit = autoCommit;
}
public void setIsolation(Integer isolation) {
this.isolation = isolation;
}
public ConnectionCreator build() {
if ( driver == null ) {
return new DriverManagerConnectionCreator( serviceRegistry, url, connectionProps, autoCommit, isolation );
}
else {
return new DriverConnectionCreator( driver, serviceRegistry, url, connectionProps, autoCommit, isolation );
}
}
}

View File

@ -0,0 +1,32 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.engine.jdbc.connections.internal;
import java.sql.Driver;
import java.util.Map;
import java.util.Properties;
import org.hibernate.service.spi.ServiceRegistryImplementor;
/**
* A factory for {@link ConnectionCreator}.
*
* @author Christian Beikov
*/
interface ConnectionCreatorFactory {
public ConnectionCreator create(
Driver driver,
ServiceRegistryImplementor serviceRegistry,
String url,
Properties connectionProps,
Boolean autocommit,
Integer isolation,
String initSql,
Map<Object, Object> configurationValues);
}

View File

@ -0,0 +1,59 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.engine.jdbc.connections.internal;
import java.sql.Driver;
import java.util.Map;
import java.util.Properties;
import org.hibernate.service.spi.ServiceRegistryImplementor;
/**
* The default factory for ConnectionCreator instances
*
* @author Christian Beikov
*/
public class ConnectionCreatorFactoryImpl implements ConnectionCreatorFactory {
public static final ConnectionCreatorFactory INSTANCE = new ConnectionCreatorFactoryImpl();
private ConnectionCreatorFactoryImpl() {
}
@Override
public ConnectionCreator create(
Driver driver,
ServiceRegistryImplementor serviceRegistry,
String url,
Properties connectionProps,
Boolean autoCommit,
Integer isolation,
String initSql,
Map<Object, Object> configurationValues) {
if ( driver == null ) {
return new DriverManagerConnectionCreator(
serviceRegistry,
url,
connectionProps,
autoCommit,
isolation,
initSql
);
}
else {
return new DriverConnectionCreator(
driver,
serviceRegistry,
url,
connectionProps,
autoCommit,
isolation,
initSql
);
}
}
}

View File

@ -27,8 +27,9 @@ public class DriverConnectionCreator extends BasicConnectionCreator {
String url,
Properties connectionProps,
Boolean autocommit,
Integer isolation) {
super( serviceRegistry, url, connectionProps, autocommit, isolation );
Integer isolation,
String initSql) {
super( serviceRegistry, url, connectionProps, autocommit, isolation, initSql );
this.driver = driver;
}

View File

@ -24,8 +24,9 @@ public class DriverManagerConnectionCreator extends BasicConnectionCreator {
String url,
Properties connectionProps,
Boolean autocommit,
Integer isolation) {
super( serviceRegistry, url, connectionProps, autocommit, isolation );
Integer isolation,
String initSql) {
super( serviceRegistry, url, connectionProps, autocommit, isolation, initSql );
}
@Override

View File

@ -57,6 +57,8 @@ public class DriverManagerConnectionProviderImpl
public static final String INITIAL_SIZE = "hibernate.connection.initial_pool_size";
// in TimeUnit.SECONDS
public static final String VALIDATION_INTERVAL = "hibernate.connection.pool_validation_interval";
public static final String INIT_SQL ="hibernate.connection.init_sql";
public static final String CONNECTION_CREATOR_FACTORY ="hibernate.connection.creator_factory_class";
private volatile PoolState state;
@ -101,14 +103,13 @@ public class DriverManagerConnectionProviderImpl
}
private static ConnectionCreator buildCreator(Map configurationValues, ServiceRegistryImplementor serviceRegistry) {
final ConnectionCreatorBuilder connectionCreatorBuilder = new ConnectionCreatorBuilder( serviceRegistry );
final String url = (String) configurationValues.get( AvailableSettings.URL );
String driverClassName = (String) configurationValues.get( AvailableSettings.DRIVER );
boolean success = false;
Driver driver = null;
if ( driverClassName != null ) {
connectionCreatorBuilder.setDriver( loadDriverIfPossible( driverClassName, serviceRegistry ) );
driver = loadDriverIfPossible( driverClassName, serviceRegistry );
success = true;
}
else if ( url != null ) {
@ -118,7 +119,7 @@ public class DriverManagerConnectionProviderImpl
driverClassName = database.getDriverClassName( url );
if ( driverClassName != null ) {
try {
connectionCreatorBuilder.setDriver( loadDriverIfPossible(driverClassName, serviceRegistry) );
loadDriverIfPossible(driverClassName, serviceRegistry);
success = true;
}
catch (Exception e) {
@ -153,7 +154,6 @@ public class DriverManagerConnectionProviderImpl
CONNECTIONS_LOGGER.error( msg );
throw new HibernateException( msg );
}
connectionCreatorBuilder.setUrl( url );
CONNECTIONS_MESSAGE_LOGGER.usingUrl( url );
@ -166,19 +166,38 @@ public class DriverManagerConnectionProviderImpl
else {
CONNECTIONS_MESSAGE_LOGGER.connectionProperties( ConfigurationHelper.maskOut( connectionProps, "password" ) );
}
connectionCreatorBuilder.setConnectionProps( connectionProps );
final boolean autoCommit = ConfigurationHelper.getBoolean( AvailableSettings.AUTOCOMMIT, configurationValues, false );
CONNECTIONS_MESSAGE_LOGGER.autoCommitMode( autoCommit );
connectionCreatorBuilder.setAutoCommit( autoCommit );
final Integer isolation = ConnectionProviderInitiator.extractIsolation( configurationValues );
if ( isolation != null ) {
CONNECTIONS_MESSAGE_LOGGER.jdbcIsolationLevel( ConnectionProviderInitiator.toIsolationNiceName( isolation ) );
}
connectionCreatorBuilder.setIsolation( isolation );
return connectionCreatorBuilder.build();
final String initSql = (String) configurationValues.get( INIT_SQL );
final Object connectionCreatorFactory = configurationValues.get( CONNECTION_CREATOR_FACTORY );
ConnectionCreatorFactory factory = null;
if ( connectionCreatorFactory instanceof ConnectionCreatorFactory ) {
factory = (ConnectionCreatorFactory) connectionCreatorFactory;
}
else if ( connectionCreatorFactory != null ) {
factory = loadConnectionCreatorFactory( connectionCreatorFactory.toString(), serviceRegistry );
}
if ( factory == null ) {
factory = ConnectionCreatorFactoryImpl.INSTANCE;
}
return factory.create(
driver,
serviceRegistry,
url,
connectionProps,
autoCommit,
isolation,
initSql,
configurationValues
);
}
private static Driver loadDriverIfPossible(String driverClassName, ServiceRegistryImplementor serviceRegistry) {
@ -206,6 +225,31 @@ public class DriverManagerConnectionProviderImpl
}
}
private static ConnectionCreatorFactory loadConnectionCreatorFactory(String connectionCreatorFactoryClassName, ServiceRegistryImplementor serviceRegistry) {
if ( connectionCreatorFactoryClassName == null ) {
CONNECTIONS_LOGGER.debug( "No connection creator factory class specified" );
return null;
}
if ( serviceRegistry != null ) {
final ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
final Class<ConnectionCreatorFactory> factoryClass = classLoaderService.classForName( connectionCreatorFactoryClassName );
try {
return factoryClass.newInstance();
}
catch ( Exception e ) {
throw new ServiceException( "Specified ConnectionCreatorFactory " + connectionCreatorFactoryClassName + " could not be loaded", e );
}
}
try {
return (ConnectionCreatorFactory) Class.forName( connectionCreatorFactoryClassName ).newInstance();
}
catch ( Exception e1 ) {
throw new ServiceException( "Specified ConnectionCreatorFactory " + connectionCreatorFactoryClassName + " could not be loaded", e1 );
}
}
// use the pool ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -14,6 +14,7 @@
<property name="hibernate.connection.driver_class">org.h2.Driver</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.connection.init_sql"></property>
<property name="hibernate.connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.cache.region_prefix">hibernate.test</property>

View File

@ -20,6 +20,7 @@
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.connection.init_sql" value="@connection.init_sql@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.testing.cache.CachingRegionFactory" />
</properties>

View File

@ -19,6 +19,7 @@
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.connection.init_sql" value="@connection.init_sql@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.testing.cache.CachingRegionFactory" />
</properties>

View File

@ -19,6 +19,7 @@
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.connection.init_sql" value="@connection.init_sql@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.testing.cache.CachingRegionFactory" />
<property name="hibernate.archive.autodetection" value="class"/>

View File

@ -25,6 +25,7 @@
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.connection.init_sql" value="@connection.init_sql@"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.region_prefix" value="hibernate.test"/>
<property name="hibernate.jdbc.use_streams_for_binary" value="true"/>

View File

@ -28,6 +28,7 @@
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.connection.init_sql" value="@connection.init_sql@"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.region_prefix" value="hibernate.test"/>
<property name="hibernate.jdbc.use_streams_for_binary" value="true"/>

View File

@ -18,6 +18,7 @@
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.connection.init_sql" value="@connection.init_sql@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.testing.cache.CachingRegionFactory" />
</properties>

View File

@ -7,4 +7,5 @@
hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@

View File

@ -18,6 +18,7 @@
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.connection.init_sql" value="@connection.init_sql@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.testing.cache.CachingRegionFactory" />
</properties>

View File

@ -19,6 +19,7 @@
<property name="hibernate.connection.username" value="@jdbc.user@"/>
<property name="hibernate.connection.password" value="@jdbc.pass@"/>
<property name="hibernate.connection.url" value="@jdbc.url@"/>
<property name="hibernate.connection.init_sql" value="@connection.init_sql@"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.testing.cache.CachingRegionFactory" />
</properties>

View File

@ -30,7 +30,6 @@ import org.hibernate.dialect.DerbyDialect;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.PostgreSQL9Dialect;
import org.hibernate.dialect.PostgresPlusDialect;
import org.hibernate.dialect.SybaseDialect;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.jpa.test.Distributor;
@ -136,7 +135,6 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
}
@Test
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
@SkipForDialect(value = DerbyDialect.class, comment = "Cannot convert untyped null (assumed to be VARBINARY type) to VARCHAR")
public void testNullPositionalParameter() throws Exception {
EntityManager em = getOrCreateEntityManager();
@ -167,7 +165,6 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
}
@Test
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
@SkipForDialect(value = DerbyDialect.class, comment = "Cannot convert untyped null (assumed to be VARBINARY type) to VARCHAR")
public void testNullPositionalParameterParameter() throws Exception {
EntityManager em = getOrCreateEntityManager();
@ -215,7 +212,6 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
}
@Test
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
@SkipForDialect(value = DerbyDialect.class, comment = "Cannot convert untyped null (assumed to be VARBINARY type) to VARCHAR")
public void testNullPositionalParameterParameterIncompatible() throws Exception {
EntityManager em = getOrCreateEntityManager();
@ -263,7 +259,6 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
}
@Test
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
@SkipForDialect(value = DerbyDialect.class, comment = "Cannot convert untyped null (assumed to be VARBINARY type) to VARCHAR")
public void testNullNamedParameter() throws Exception {
EntityManager em = getOrCreateEntityManager();
@ -294,7 +289,6 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
}
@Test
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
@SkipForDialect(value = DerbyDialect.class, comment = "Cannot convert untyped null (assumed to be VARBINARY type) to VARCHAR")
public void testNullNamedParameterParameter() throws Exception {
EntityManager em = getOrCreateEntityManager();
@ -341,7 +335,6 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
}
@Test
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
@SkipForDialect(value = DerbyDialect.class, comment = "Cannot convert untyped null (assumed to be VARBINARY type) to VARCHAR")
public void testNullNamedParameterParameterIncompatible() throws Exception {
EntityManager em = getOrCreateEntityManager();
@ -392,7 +385,6 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = CockroachDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
@SkipForDialect(value = DerbyDialect.class, comment = "Cannot convert untyped null (assumed to be VARBINARY type) to INTEGER")
public void testNativeQueryNullPositionalParameter() throws Exception {
EntityManager em = getOrCreateEntityManager();
@ -430,7 +422,6 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = CockroachDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = Oracle8iDialect.class, comment = "ORA-00932: inconsistent datatypes: expected NUMBER got BINARY")
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
@SkipForDialect(value = DerbyDialect.class, comment = "Cannot convert untyped null (assumed to be VARBINARY type) to INTEGER")
public void testNativeQueryNullPositionalParameterParameter() throws Exception {
EntityManager em = getOrCreateEntityManager();
@ -484,7 +475,6 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = CockroachDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
@SkipForDialect(value = DerbyDialect.class, comment = "Cannot convert untyped null (assumed to be VARBINARY type) to INTEGER")
public void testNativeQueryNullNamedParameter() throws Exception {
EntityManager em = getOrCreateEntityManager();
@ -522,7 +512,6 @@ public class QueryTest extends BaseEntityManagerFunctionalTestCase {
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = CockroachDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = Oracle8iDialect.class, comment = "ORA-00932: inconsistent datatypes: expected NUMBER got BINARY")
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
@SkipForDialect(value = DerbyDialect.class, comment = "Cannot convert untyped null (assumed to be VARBINARY type) to INTEGER")
public void testNativeQueryNullNamedParameterParameter() throws Exception {
EntityManager em = getOrCreateEntityManager();

View File

@ -16,7 +16,6 @@ import org.hibernate.Hibernate;
import org.hibernate.Transaction;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.SybaseDialect;
import org.hibernate.orm.test.bootstrap.binding.annotations.embedded.FloatLeg.RateIndex;
import org.hibernate.orm.test.bootstrap.binding.annotations.embedded.Leg.Frequency;
import org.hibernate.query.Query;
@ -27,7 +26,6 @@ import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.hibernate.testing.orm.junit.Setting;
import org.hibernate.testing.orm.junit.SkipForDialect;
import org.hibernate.orm.test.util.SchemaUtil;
import org.junit.jupiter.api.AfterEach;
@ -142,7 +140,6 @@ public class EmbeddedTest {
@Test
@TestForIssue(jiraKey = "HHH-8172")
@SkipForDialect(dialectClass = SybaseDialect.class, reason = "Null == null on Sybase", matchSubTypes = true)
public void testQueryWithEmbeddedParameterAllNull(SessionFactoryScope scope) {
Person person = new Person();
Address a = new Address();

View File

@ -373,6 +373,7 @@ public class PersistenceUnitOverridesTests extends BaseUnitTestCase {
integrationSettings.put( AvailableSettings.JPA_JDBC_URL, ConnectionProviderBuilder.URL );
integrationSettings.put( AvailableSettings.JPA_JDBC_USER, ConnectionProviderBuilder.USER );
integrationSettings.put( AvailableSettings.JPA_JDBC_PASSWORD, ConnectionProviderBuilder.PASS );
integrationSettings.put( "hibernate.connection.init_sql", "" );
final PersistenceProvider provider = new HibernatePersistenceProvider();

View File

@ -21,6 +21,7 @@ import org.hibernate.Transaction;
import org.hibernate.boot.Metadata;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.dialect.SybaseASEDialect;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Formula;
import org.hibernate.mapping.PersistentClass;
@ -180,7 +181,7 @@ public class ComponentTest extends BaseNonConfigCoreFunctionalTestCase {
}
@Test
@RequiresDialect( value = SybaseASE15Dialect.class )
@RequiresDialect( value = SybaseASEDialect.class )
@FailureExpected( jiraKey = "HHH-3150" )
public void testComponentQueryMethodNoParensFailureExpected() {
// Sybase should translate "current_timestamp" in HQL to "getdate()";

View File

@ -56,6 +56,7 @@ public class ConnectionCreatorTest extends BaseUnitTestCase {
"jdbc:h2:mem:test-bad-urls;nosuchparam=saywhat",
new Properties(),
false,
null,
null
);

View File

@ -31,6 +31,7 @@ import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import org.hibernate.dialect.SybaseASEDialect;
import org.hibernate.query.Query;
import org.hibernate.Session;
import org.hibernate.dialect.SybaseASE15Dialect;
@ -43,11 +44,16 @@ import org.junit.Test;
*
* @author Richard H. Tingstad
*/
@RequiresDialect(value = { SybaseASE15Dialect.class })
@RequiresDialect(value = { SybaseASEDialect.class })
public class SybaseASE15FunctionTest extends BaseCoreFunctionalTestCase {
private Calendar calendar = Calendar.getInstance();
@Override
protected String getBaseForMappings() {
return "org/hibernate/orm/test/";
}
@Override
public String[] getMappings() {
return new String[] { "dialect/function/Product.hbm.xml" };
@ -89,7 +95,7 @@ public class SybaseASE15FunctionTest extends BaseCoreFunctionalTestCase {
public void testDateaddFunction() {
final Session s = openSession();
s.getTransaction().begin();
Query query = session.createQuery( "select dateadd(dd, 1, p.date) from Product p" );
Query query = session.createQuery( "select dateadd(day, 1, p.date) from Product p" );
assertTrue(calendar.getTime().before((Date) query.uniqueResult()));
s.getTransaction().commit();
s.close();

View File

@ -12,12 +12,10 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import org.hibernate.dialect.SybaseDialect;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.hibernate.testing.orm.junit.SkipForDialect;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -62,7 +60,6 @@ public class EmbeddableAsParameterTest {
}
@Test
@SkipForDialect(dialectClass = SybaseDialect.class, reason = "Null == null on Sybase", matchSubTypes = true)
public void testAsParameterReuseInWhereClause2(SessionFactoryScope scope) {
scope.inTransaction(
session -> {

View File

@ -29,11 +29,11 @@ import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.dialect.PostgreSQL9Dialect;
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.PostgresPlusDialect;
import org.hibernate.dialect.SybaseDialect;
import org.hibernate.query.NativeQuery;
import org.hibernate.stat.Statistics;
import org.hibernate.type.DateType;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -107,7 +107,6 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = CockroachDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
@SkipForDialect(value = DerbyDialect.class, comment = "Cannot convert untyped null (assumed to be VARBINARY type) to BIGINT")
public void testQueryWithNullParameter(){
Chaos c0 = new Chaos();
@ -149,7 +148,6 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
@Test
@TestForIssue( jiraKey = "HHH-10161")
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
public void testQueryWithNullParameterTyped(){
Chaos c0 = new Chaos();
c0.setId( 0L );
@ -194,7 +192,6 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
@SkipForDialect(value = PostgreSQL9Dialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = PostgresPlusDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = CockroachDialect.class, jiraKey = "HHH-10312", comment = "Cannot convert untyped null (assumed to be bytea type) to bigint")
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
@SkipForDialect(value = DerbyDialect.class, comment = "Cannot convert untyped null (assumed to be VARBINARY type) to BIGINT")
public void testNativeQueryWithNullParameter(){
Chaos c0 = new Chaos();
@ -236,7 +233,6 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
@Test
@TestForIssue( jiraKey = "HHH-10161")
@SkipForDialect(value = SybaseDialect.class, comment = "Null == null on Sybase")
public void testNativeQueryWithNullParameterTyped(){
Chaos c0 = new Chaos();
c0.setId( 0L );

View File

@ -10,6 +10,7 @@ hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
hibernate.connection.pool_size 5

View File

@ -50,6 +50,8 @@ public abstract class AbstractOneSessionTest extends AbstractEnversTest {
}
config.setProperty( Environment.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
config.setProperty( EnversSettings.USE_REVISION_ENTITY_WITH_NATIVE_ID, "false" );
// These tests always use H2, so we reset the init_sql config here
config.setProperty( "hibernate.connection.init_sql", "" );
addProperties( config );
this.initMappings();

View File

@ -9,6 +9,7 @@ hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
hibernate.connection.pool_size 5

View File

@ -9,6 +9,7 @@ hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
hibernate.jdbc.batch_size 10
hibernate.connection.provider_class HikariCPConnectionProvider

View File

@ -9,6 +9,7 @@ hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
hibernate.connection.pool_size 5

View File

@ -10,6 +10,7 @@ hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
hibernate.connection.pool_size 5

View File

@ -9,6 +9,7 @@ hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
hibernate.connection.pool_size 5
hibernate.jdbc.batch_size 10

View File

@ -12,6 +12,7 @@ hibernate.connection.driver_class=@jdbc.driver@
hibernate.connection.url=@jdbc.url@
hibernate.connection.username=@jdbc.user@
hibernate.connection.password=@jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
#hibernate.cache.region_prefix hibernate.test
#hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
#

View File

@ -44,6 +44,7 @@ public class ConnectionProviderBuilder implements DialectCheck {
props.put( Environment.URL, String.format( URL_FORMAT, dbName ) );
props.put( Environment.USER, USER );
props.put( Environment.PASS, PASS );
props.put( "hibernate.connection.init_sql", "" );
return props;
}
@ -53,6 +54,7 @@ public class ConnectionProviderBuilder implements DialectCheck {
props.put( Environment.JPA_JDBC_URL, String.format( URL_FORMAT, dbName ) );
props.put( Environment.JPA_JDBC_USER, USER );
props.put( Environment.JPA_JDBC_PASSWORD, PASS );
props.put( "hibernate.connection.init_sql", "" );
return props;
}

View File

@ -10,6 +10,7 @@ hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
hibernate.connection.pool_size 5

View File

@ -9,6 +9,7 @@ hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
hibernate.jdbc.batch_size 10
hibernate.connection.provider_class ViburDBCPConnectionProvider