Skip to content

Commit 7964869

Browse files
committed
Fixes for nightly failures of PG and EDB v12, DB2 10.5 and MariaDB. Exclude Oracle 21 from nightly runs in favor of Atlas build
1 parent 862f573 commit 7964869

File tree

7 files changed

+42
-41
lines changed

7 files changed

+42
-41
lines changed

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/PostgresPlusLegacyDialect.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,18 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
6161
functionFactory.sysdate();
6262
functionFactory.systimestamp();
6363

64-
functionFactory.bitand();
65-
functionFactory.bitor();
66-
functionContributions.getFunctionRegistry().patternDescriptorBuilder( "bitxor", "(bitor(?1,?2)-bitand(?1,?2))" )
67-
.setExactArgumentCount( 2 )
68-
.setArgumentTypeResolver( StandardFunctionArgumentTypeResolvers.ARGUMENT_OR_IMPLIED_RESULT_TYPE )
69-
.register();
70-
64+
if ( getVersion().isSameOrAfter( 14 ) ) {
65+
// Support for these functions were apparently only added in version 14
66+
functionFactory.bitand();
67+
functionFactory.bitor();
68+
functionContributions.getFunctionRegistry().patternDescriptorBuilder(
69+
"bitxor",
70+
"(bitor(?1,?2)-bitand(?1,?2))"
71+
)
72+
.setExactArgumentCount( 2 )
73+
.setArgumentTypeResolver( StandardFunctionArgumentTypeResolvers.ARGUMENT_OR_IMPLIED_RESULT_TYPE )
74+
.register();
75+
}
7176
}
7277

7378
@Override

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,19 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
6161
functionFactory.rownumRowid();
6262
functionFactory.sysdate();
6363
functionFactory.systimestamp();
64-
65-
functionFactory.bitand();
66-
functionFactory.bitor();
67-
functionContributions.getFunctionRegistry().patternDescriptorBuilder( "bitxor", "(bitor(?1,?2)-bitand(?1,?2))" )
68-
.setExactArgumentCount( 2 )
69-
.setArgumentTypeResolver( StandardFunctionArgumentTypeResolvers.ARGUMENT_OR_IMPLIED_RESULT_TYPE )
70-
.register();
64+
65+
if ( getVersion().isSameOrAfter( 14 ) ) {
66+
// Support for these functions were apparently only added in version 14
67+
functionFactory.bitand();
68+
functionFactory.bitor();
69+
functionContributions.getFunctionRegistry().patternDescriptorBuilder(
70+
"bitxor",
71+
"(bitor(?1,?2)-bitand(?1,?2))"
72+
)
73+
.setExactArgumentCount( 2 )
74+
.setArgumentTypeResolver( StandardFunctionArgumentTypeResolvers.ARGUMENT_OR_IMPLIED_RESULT_TYPE )
75+
.register();
76+
}
7177
}
7278

7379
@Override

hibernate-core/src/test/java/org/hibernate/orm/test/function/array/ArrayTrimTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void testTrimAll(SessionFactoryScope scope) {
8787
}
8888

8989
@Test
90-
@SkipForDialect(dialectClass = PostgreSQLDialect.class, majorVersion = 12, reason = "The PostgreSQL emulation for version < 14 doesn't throw an error")
90+
@SkipForDialect(dialectClass = PostgreSQLDialect.class, majorVersion = 12, matchSubTypes = true, reason = "The PostgreSQL emulation for version < 14 doesn't throw an error")
9191
@SkipForDialect(dialectClass = CockroachDialect.class, reason = "The Cockroach emulation doesn't throw an error")
9292
public void testTrimOutOfRange(SessionFactoryScope scope) {
9393
scope.inSession( em -> {

hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/ManipulationCriteriaTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public void testJoinsAndFetchesDisallowed() {
206206

207207
@Test
208208
// MySQL does not allow "delete/update from" and subqueries to use the same table
209-
@SkipForDialect(dialectClass = MySQLDialect.class)
209+
@SkipForDialect(dialectClass = MySQLDialect.class, matchSubTypes = true)
210210
public void testDeleteWithUnCorrelatedSubquery() {
211211
CriteriaBuilder builder = entityManagerFactory().getCriteriaBuilder();
212212
EntityManager em = getOrCreateEntityManager();

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/generated/delegate/GeneratedWritableDelegateTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,13 @@ public void setUp(SessionFactoryScope scope) {
145145
scope.inTransaction( s -> {
146146
s.createNativeMutationQuery( "create or replace function fun_upper_name() returns trigger as " + TRIGGER )
147147
.executeUpdate();
148+
s.createNativeMutationQuery( "drop trigger if exists upper_name_1 on values_only" ).executeUpdate();
149+
s.createNativeMutationQuery( "drop trigger if exists upper_name_2 on values_and_identity" ).executeUpdate();
148150
s.createNativeMutationQuery(
149-
"create or replace trigger upper_name_1 before insert or update on values_only for each row execute procedure fun_upper_name()"
151+
"create trigger upper_name_1 before insert or update on values_only for each row execute procedure fun_upper_name()"
150152
).executeUpdate();
151153
s.createNativeMutationQuery(
152-
"create or replace trigger upper_name_2 before insert or update on values_and_identity for each row execute procedure fun_upper_name()"
154+
"create trigger upper_name_2 before insert or update on values_and_identity for each row execute procedure fun_upper_name()"
153155
).executeUpdate();
154156
} );
155157
}

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

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public void prepareSchema(EntityManagerFactoryScope scope) {
254254
" SELECT COUNT(*) INTO phoneCount " +
255255
" FROM phone " +
256256
" WHERE person_id = personId; " +
257-
"END;"
257+
"END"
258258
);
259259
statement.executeUpdate(
260260
"CREATE OR REPLACE PROCEDURE sp_person_phones( " +
@@ -266,7 +266,7 @@ public void prepareSchema(EntityManagerFactoryScope scope) {
266266
" FROM phone " +
267267
" WHERE person_id = personId; " +
268268
" OPEN personPhones; " +
269-
"END;"
269+
"END"
270270
);
271271
statement.executeUpdate(
272272
"CREATE OR REPLACE FUNCTION fn_count_phones( " +
@@ -278,7 +278,7 @@ public void prepareSchema(EntityManagerFactoryScope scope) {
278278
" FROM phone " +
279279
" WHERE person_id = personId; " +
280280
" RETURN phoneCount; " +
281-
"END;"
281+
"END"
282282
);
283283
statement.executeUpdate(
284284
"CREATE OR REPLACE FUNCTION fn_person_and_phones(personId INTEGER) " +
@@ -293,7 +293,7 @@ public void prepareSchema(EntityManagerFactoryScope scope) {
293293
" \"ph.id\" BIGINT, " +
294294
" \"ph.person_id\" BIGINT, " +
295295
" \"ph.phone_number\" VARCHAR(255), " +
296-
" \"ph.valid\" BOOLEAN " +
296+
" \"ph.valid\" SMALLINT " +
297297
" ) " +
298298
" BEGIN ATOMIC " +
299299
" RETURN SELECT pr.id AS \"pr.id\", " +
@@ -309,7 +309,7 @@ public void prepareSchema(EntityManagerFactoryScope scope) {
309309
" FROM person pr " +
310310
" JOIN phone ph ON pr.id = ph.person_id " +
311311
" WHERE pr.id = personId; " +
312-
" END; " );
312+
" END " );
313313
statement.executeUpdate(
314314
"CREATE OR REPLACE " +
315315
"PROCEDURE singleRefCursor(OUT p_recordset CURSOR) " +
@@ -318,7 +318,7 @@ public void prepareSchema(EntityManagerFactoryScope scope) {
318318
" SELECT 1 as id " +
319319
" FROM sysibm.dual; " +
320320
" OPEN p_recordset; " +
321-
" END; "
321+
" END "
322322
);
323323
statement.executeUpdate(
324324
"CREATE OR REPLACE " +
@@ -329,37 +329,33 @@ public void prepareSchema(EntityManagerFactoryScope scope) {
329329
" FROM sysibm.dual; " +
330330
" SELECT 1 INTO p_value FROM sysibm.dual; " +
331331
" OPEN p_recordset; " +
332-
" END; "
332+
" END"
333333
);
334334
statement.executeUpdate(
335335
"CREATE OR REPLACE PROCEDURE sp_phone_validity ( " +
336-
" IN validity BOOLEAN, " +
336+
" IN validity SMALLINT, " +
337337
" OUT personPhones CURSOR ) " +
338338
"BEGIN " +
339339
" SET personPhones = CURSOR FOR " +
340340
" SELECT phone_number " +
341341
" FROM phone " +
342342
" WHERE valid = validity; " +
343343
" OPEN personPhones; " +
344-
"END;"
344+
"END"
345345
);
346346
statement.executeUpdate(
347347
"CREATE OR REPLACE PROCEDURE sp_votes ( " +
348-
" IN validity BOOLEAN, " +
348+
" IN validity CHAR(1), " +
349349
" OUT votes CURSOR ) " +
350350
"BEGIN " +
351351
" SET votes = CURSOR FOR " +
352352
" SELECT id " +
353353
" FROM vote " +
354354
" WHERE vote_choice = validity; " +
355355
" OPEN votes; " +
356-
"END;"
356+
"END"
357357
);
358358
}
359-
catch (final SQLException e) {
360-
System.err.println( "Error exporting procedure and function definitions to DB2 database : " + e.getMessage() );
361-
e.printStackTrace( System.err );
362-
}
363359
} ) );
364360

365361
scope.inTransaction( (entityManager) -> {

nightly.Jenkinsfile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ stage('Configure') {
3232
new BuildEnvironment( dbName: 'mariadb_10_4' ),
3333
new BuildEnvironment( dbName: 'postgresql_12' ),
3434
new BuildEnvironment( dbName: 'edb_12' ),
35-
new BuildEnvironment( dbName: 'oracle_21' ), // Did not find an image for Oracle-XE 19c
3635
new BuildEnvironment( dbName: 'db2_10_5', longRunning: true ),
3736
new BuildEnvironment( dbName: 'mssql_2017' ), // Unfortunately there is no SQL Server 2008 image, so we have to test with 2017
3837
// new BuildEnvironment( dbName: 'sybase_16' ), // There only is a Sybase ASE 16 image, so no pint in testing that nightly
@@ -137,13 +136,6 @@ stage('Build') {
137136
sh "./docker_db.sh edb_12"
138137
state[buildEnv.tag]['containerName'] = "edb"
139138
break;
140-
case "oracle_21":
141-
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
142-
docker.image('gvenzl/oracle-xe:21.3.0').pull()
143-
}
144-
sh "./docker_db.sh oracle_21"
145-
state[buildEnv.tag]['containerName'] = "oracle"
146-
break;
147139
case "db2_10_5":
148140
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
149141
docker.image('ibmoms/db2express-c@sha256:a499afd9709a1f69fb41703e88def9869955234c3525547e2efc3418d1f4ca2b').pull()

0 commit comments

Comments
 (0)