Skip to content

Commit 6b1ea3e

Browse files
committed
HHH-18804 Add XML aggregate support for HANA
1 parent c02eae1 commit 6b1ea3e

18 files changed

+1808
-65
lines changed

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ private static void toString(
111111
Object domainValue,
112112
char separator) {
113113
final Object[] values = embeddableMappingType.getValues( domainValue );
114-
final int numberOfAttributes = embeddableMappingType.getNumberOfAttributeMappings();
115114
for ( int i = 0; i < values.length; i++ ) {
116115
final ValuedModelPart attributeMapping = getEmbeddedPart( embeddableMappingType, i );
117116
if ( attributeMapping instanceof SelectableMapping ) {
@@ -312,13 +311,7 @@ private static void convertedBasicValueToString(
312311
case SqlTypes.MATERIALIZED_BLOB:
313312
// These types need to be serialized as JSON string, and for efficiency uses appendString directly
314313
appender.append( '"' );
315-
appender.write(
316-
javaType.unwrap(
317-
value,
318-
byte[].class,
319-
options
320-
)
321-
);
314+
appender.write( javaType.unwrap( value, byte[].class, options ) );
322315
appender.append( '"' );
323316
break;
324317
case SqlTypes.ARRAY:

hibernate-core/src/main/java/org/hibernate/dialect/aggregate/AggregateSupport.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ default String aggregateComponentCustomReadExpression(
6565
column.getScale(),
6666
column.getTemporalPrecision(),
6767
column.getType()
68-
)
68+
),
69+
aggregateColumn.getComponent().getMetadata().getTypeConfiguration()
6970
);
7071
}
7172

@@ -80,7 +81,7 @@ default String aggregateComponentCustomReadExpression(
8081
* @param columnExpression The column within the aggregate type, for which to return the read expression
8182
* @param aggregateColumnTypeCode The SQL type code of the aggregate column
8283
* @param column The column within the aggregate type, for which to return the read expression
83-
*
84+
* @param typeConfiguration The type configuration
8485
* @since 7.0
8586
*/
8687
String aggregateComponentCustomReadExpression(
@@ -89,7 +90,8 @@ String aggregateComponentCustomReadExpression(
8990
String aggregateParentReadExpression,
9091
String columnExpression,
9192
int aggregateColumnTypeCode,
92-
SqlTypedMapping column);
93+
SqlTypedMapping column,
94+
TypeConfiguration typeConfiguration);
9395

9496
/**
9597
* Returns the assignment expression to use for {@code column},

hibernate-core/src/main/java/org/hibernate/dialect/aggregate/AggregateSupportImpl.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ public class AggregateSupportImpl implements AggregateSupport {
2121
public static final AggregateSupport INSTANCE = new AggregateSupportImpl();
2222

2323
@Override
24-
public String aggregateComponentCustomReadExpression(String template, String placeholder, String aggregateParentReadExpression, String columnExpression, int aggregateColumnTypeCode, SqlTypedMapping column) {
24+
public String aggregateComponentCustomReadExpression(
25+
String template,
26+
String placeholder,
27+
String aggregateParentReadExpression,
28+
String columnExpression,
29+
int aggregateColumnTypeCode,
30+
SqlTypedMapping column,
31+
TypeConfiguration typeConfiguration) {
2532
throw new UnsupportedOperationException( "Dialect does not support aggregateComponentCustomReadExpression: " + getClass().getName() );
2633
}
2734

hibernate-core/src/main/java/org/hibernate/dialect/aggregate/CockroachDBAggregateSupport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public String aggregateComponentCustomReadExpression(
4949
String aggregateParentReadExpression,
5050
String columnExpression,
5151
int aggregateColumnTypeCode,
52-
SqlTypedMapping column) {
52+
SqlTypedMapping column,
53+
TypeConfiguration typeConfiguration) {
5354
switch ( aggregateColumnTypeCode ) {
5455
case JSON_ARRAY:
5556
case JSON:

hibernate-core/src/main/java/org/hibernate/dialect/aggregate/DB2AggregateSupport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ public String aggregateComponentCustomReadExpression(
7373
String aggregateParentReadExpression,
7474
String columnExpression,
7575
int aggregateColumnTypeCode,
76-
SqlTypedMapping column) {
76+
SqlTypedMapping column,
77+
TypeConfiguration typeConfiguration) {
7778
switch ( aggregateColumnTypeCode ) {
7879
case JSON:
7980
case JSON_ARRAY:

hibernate-core/src/main/java/org/hibernate/dialect/aggregate/H2AggregateSupport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ public String aggregateComponentCustomReadExpression(
4848
String aggregateParentReadExpression,
4949
String columnExpression,
5050
int aggregateColumnTypeCode,
51-
SqlTypedMapping column) {
51+
SqlTypedMapping column,
52+
TypeConfiguration typeConfiguration) {
5253
switch ( aggregateColumnTypeCode ) {
5354
case JSON_ARRAY:
5455
case JSON:

0 commit comments

Comments
 (0)