Skip to content

Commit ce0ff93

Browse files
committed
HHH-19624 Test EDB with EDB drivers
1 parent 76ac820 commit ce0ff93

16 files changed

+110
-74
lines changed

documentation/documentation.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ dependencies {
182182
javadocClasspath jakartaLibs.jsonbApi
183183
javadocClasspath libs.ant
184184
javadocClasspath dbLibs.postgresql
185+
javadocClasspath dbLibs.edb
185186
javadocClasspath libs.jackson
186187
javadocClasspath gradleApi()
187188
javadocClasspath libs.jacksonXml

gradle/databases.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ ext {
7979
],
8080
edb_ci : [
8181
'db.dialect' : 'org.hibernate.dialect.PostgresPlusDialect',
82-
'jdbc.driver': 'org.postgresql.Driver',
82+
'jdbc.driver': 'com.edb.Driver',
8383
'jdbc.user' : 'hibernate_orm_test',
8484
'jdbc.pass' : 'hibernate_orm_test',
8585
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
86-
'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn',
87-
'jdbc.datasource' : 'org.postgresql.Driver',
88-
// 'jdbc.datasource' : 'org.postgresql.ds.PGSimpleDataSource',
86+
'jdbc.url' : 'jdbc:edb://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn',
87+
'jdbc.datasource' : 'com.edb.Driver',
88+
// 'jdbc.datasource' : 'com.edb.ds.PGSimpleDataSource',
8989
'connection.init_sql' : ''
9090
],
9191
sybase_ci : [

gradle/java-module.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ dependencies {
9999
testRuntimeOnly dbLibs.derbyTools
100100
testRuntimeOnly dbLibs.hsqldb
101101
testRuntimeOnly dbLibs.postgresql
102+
testRuntimeOnly dbLibs.edb
102103
testRuntimeOnly dbLibs.mssql
103104
testRuntimeOnly dbLibs.informix
104105
testRuntimeOnly dbLibs.cockroachdb

hibernate-core/hibernate-core.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ dependencies {
4545
compileOnly libs.jackson
4646
compileOnly libs.jacksonXml
4747
compileOnly dbLibs.postgresql
48+
compileOnly dbLibs.edb
4849

4950
testImplementation project(':hibernate-testing')
5051
testImplementation project(':hibernate-ant')

hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLCastingIntervalSecondJdbcType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void appendWriteExpression(
7979
Dialect dialect) {
8080
appender.append( '(' );
8181
appender.append( writeExpression );
82-
appender.append( "*interval'1 second)" );
82+
appender.append( "*interval'1 second')" );
8383
}
8484

8585
@Override

hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ private static OptionalTableUpdateStrategy determineOptionalTableUpdateStrategy(
179179
: PostgreSQLDialect::withoutMerge;
180180
}
181181

182+
public PostgreSQLDriverKind getDriverKind() {
183+
return driverKind;
184+
}
185+
182186
@Override
183187
protected DatabaseVersion getMinimumSupportedVersion() {
184188
return MINIMUM_VERSION;

hibernate-core/src/test/java/org/hibernate/orm/test/id/usertype/PostgreSQLMultipleTypesOtherContributorTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@
1818
import org.hibernate.annotations.JdbcTypeCode;
1919
import org.hibernate.boot.spi.MetadataBuilderContributor;
2020
import org.hibernate.boot.spi.MetadataBuilderImplementor;
21-
import org.hibernate.dialect.PostgreSQLDialect;
2221
import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl;
2322
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
2423
import org.hibernate.query.NativeQuery;
24+
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
25+
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
2526
import org.hibernate.type.SqlTypes;
2627
import org.hibernate.type.spi.TypeConfiguration;
2728

28-
import org.hibernate.testing.RequiresDialect;
29-
3029
import org.hibernate.orm.test.id.usertype.inet.Inet;
3130
import org.hibernate.orm.test.id.usertype.inet.InetJavaType;
3231
import org.hibernate.orm.test.id.usertype.inet.InetJdbcType;
@@ -43,7 +42,7 @@
4342
/**
4443
* @author Vlad Mihalcea
4544
*/
46-
@RequiresDialect(PostgreSQLDialect.class)
45+
@RequiresDialectFeature(feature = DialectFeatureChecks.IsPgJdbc.class)
4746
public class PostgreSQLMultipleTypesOtherContributorTest extends BaseEntityManagerFunctionalTestCase {
4847

4948
@Override

hibernate-core/src/test/java/org/hibernate/orm/test/id/usertype/inet/PostgreSQLInetTypesOtherContributorTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
import org.hibernate.boot.MetadataBuilder;
1313
import org.hibernate.boot.spi.MetadataBuilderContributor;
1414
import org.hibernate.boot.spi.MetadataBuilderImplementor;
15-
import org.hibernate.dialect.PostgreSQLDialect;
1615
import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl;
16+
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
17+
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
1718
import org.hibernate.type.spi.TypeConfiguration;
1819

19-
import org.hibernate.testing.RequiresDialect;
2020
import org.junit.Test;
2121

2222
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
@@ -25,7 +25,7 @@
2525
/**
2626
* @author Vlad Mihalcea
2727
*/
28-
@RequiresDialect(PostgreSQLDialect.class)
28+
@RequiresDialectFeature(feature = DialectFeatureChecks.IsPgJdbc.class)
2929
public class PostgreSQLInetTypesOtherContributorTest extends PostgreSQLInetTypesOtherTest {
3030

3131
@Override

hibernate-core/src/test/java/org/hibernate/orm/test/id/usertype/inet/PostgreSQLInetTypesOtherTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
import org.hibernate.boot.spi.MetadataBuilderContributor;
1313
import org.hibernate.boot.spi.MetadataBuilderImplementor;
14-
import org.hibernate.dialect.PostgreSQLDialect;
1514
import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl;
1615
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
1716
import org.hibernate.query.NativeQuery;
17+
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
18+
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
1819
import org.hibernate.type.spi.TypeConfiguration;
1920

20-
import org.hibernate.testing.RequiresDialect;
2121
import org.junit.Test;
2222

2323
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
@@ -26,7 +26,7 @@
2626
/**
2727
* @author Vlad Mihalcea
2828
*/
29-
@RequiresDialect(PostgreSQLDialect.class)
29+
@RequiresDialectFeature(feature = DialectFeatureChecks.IsPgJdbc.class)
3030
public class PostgreSQLInetTypesOtherTest extends BaseEntityManagerFunctionalTestCase {
3131

3232
@Override

hibernate-core/src/test/java/org/hibernate/orm/test/procedure/PostgreSQLFunctionProcedureTest.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import java.sql.CallableStatement;
1010
import java.sql.ResultSet;
1111
import java.sql.SQLException;
12-
import java.sql.SQLFeatureNotSupportedException;
1312
import java.sql.Timestamp;
1413
import java.sql.Types;
1514
import java.time.LocalDateTime;
@@ -236,34 +235,6 @@ public void testFunctionWithJDBC() {
236235
} );
237236
}
238237

239-
@Test
240-
public void testFunctionWithJDBCByName() {
241-
doInJPA( this::entityManagerFactory, entityManager -> {
242-
try {
243-
Session session = entityManager.unwrap( Session.class );
244-
Long phoneCount = session.doReturningWork( connection -> {
245-
CallableStatement function = null;
246-
try {
247-
function = connection.prepareCall( "{ ? = call fn_count_phones(?) }" );
248-
function.registerOutParameter( "phoneCount", Types.BIGINT );
249-
function.setLong( "personId", 1L );
250-
function.execute();
251-
return function.getLong( 1 );
252-
}
253-
finally {
254-
if ( function != null ) {
255-
function.close();
256-
}
257-
}
258-
} );
259-
assertEquals( Long.valueOf( 2 ), phoneCount );
260-
}
261-
catch (Exception e) {
262-
assertEquals( SQLFeatureNotSupportedException.class, e.getCause().getClass() );
263-
}
264-
} );
265-
}
266-
267238
@Test
268239
@TestForIssue(jiraKey = "HHH-11863")
269240
public void testSysRefCursorAsOutParameter() {

0 commit comments

Comments
 (0)