Skip to content

Commit 4d6f9ba

Browse files
committed
HHH-18796 Add JSON aggregate support for DB2
1 parent 26a8a69 commit 4d6f9ba

File tree

13 files changed

+646
-71
lines changed

13 files changed

+646
-71
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
439439
functionFactory.jsonArray_db2();
440440
functionFactory.jsonArrayAgg_db2();
441441
functionFactory.jsonObjectAgg_db2();
442-
functionFactory.jsonTable_db2();
442+
functionFactory.jsonTable_db2( getMaximumSeriesSize() );
443443
}
444444
}
445445

@@ -459,7 +459,7 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
459459
functionFactory.xmlagg();
460460
functionFactory.xmltable_db2();
461461

462-
functionFactory.unnest_emulated();
462+
functionFactory.unnest_db2( getMaximumSeriesSize() );
463463
if ( supportsRecursiveCTE() ) {
464464
functionFactory.generateSeries_recursive( getMaximumSeriesSize(), false, true );
465465
}
@@ -1007,7 +1007,9 @@ public <X> ValueExtractor<X> getExtractor(JavaType<X> javaType) {
10071007

10081008
@Override
10091009
public AggregateSupport getAggregateSupport() {
1010-
return DB2AggregateSupport.INSTANCE;
1010+
return getDB2Version().isSameOrAfter( 11 )
1011+
? DB2AggregateSupport.JSON_INSTANCE
1012+
: DB2AggregateSupport.INSTANCE;
10111013
}
10121014

10131015
@Override

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
410410
functionFactory.jsonArray_db2();
411411
functionFactory.jsonArrayAgg_db2();
412412
functionFactory.jsonObjectAgg_db2();
413-
functionFactory.jsonTable_db2();
413+
functionFactory.jsonTable_db2( getMaximumSeriesSize() );
414414
}
415415

416416
functionFactory.xmlelement();
@@ -429,7 +429,7 @@ public void initializeFunctionRegistry(FunctionContributions functionContributio
429429
functionFactory.xmlagg();
430430
functionFactory.xmltable_db2();
431431

432-
functionFactory.unnest_emulated();
432+
functionFactory.unnest_db2( getMaximumSeriesSize() );
433433
functionFactory.generateSeries_recursive( getMaximumSeriesSize(), false, true );
434434
}
435435

@@ -1066,7 +1066,9 @@ public <X> ValueExtractor<X> getExtractor(JavaType<X> javaType) {
10661066

10671067
@Override
10681068
public AggregateSupport getAggregateSupport() {
1069-
return DB2AggregateSupport.INSTANCE;
1069+
return getDB2Version().isSameOrAfter( 11 )
1070+
? DB2AggregateSupport.JSON_INSTANCE
1071+
: DB2AggregateSupport.INSTANCE;
10701072
}
10711073

10721074
@Override

0 commit comments

Comments
 (0)