Skip to content

Commit bcd70a8

Browse files
committed
Fix some JSON function rendering issues on HANA
1 parent 4a2ee83 commit bcd70a8

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public String aggregateComponentCustomReadExpression(
115115
if ( SqlTypes.isBinaryType( column.getJdbcMapping().getJdbcType().getDdlTypeCode() ) ) {
116116
return template.replace(
117117
placeholder,
118-
"hextobin(json_value(" + parentPartExpression + columnExpression + "'))"
118+
"hextobin(replace(json_value(" + parentPartExpression + columnExpression + "'),'-',''))"
119119
);
120120
}
121121
// Fall-through intended

hibernate-core/src/main/java/org/hibernate/dialect/function/json/HANAJsonObjectAggFunction.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,13 @@ protected void renderArgument(
7171
sqlAppender.appendSql( " as nvarchar(" + Integer.MAX_VALUE + "))" );
7272
}
7373
else {
74-
if ( nullBehavior != JsonNullBehavior.NULL ) {
75-
sqlAppender.appendSql( "nullif(" );
76-
}
7774
sqlAppender.appendSql( "json_query((select " );
7875
arg.accept( translator );
7976
sqlAppender.appendSql( " V from sys.dummy for json('arraywrap'='no'" );
80-
if ( nullBehavior != JsonNullBehavior.NULL ) {
77+
if ( nullBehavior == JsonNullBehavior.NULL ) {
8178
sqlAppender.appendSql( ",'omitnull'='no'" );
8279
}
8380
sqlAppender.appendSql( ") returns nvarchar(" + Integer.MAX_VALUE + ")),'$.V')" );
84-
if ( nullBehavior != JsonNullBehavior.NULL ) {
85-
sqlAppender.appendSql( ",'null')" );
86-
}
8781
}
8882
}
8983
}

0 commit comments

Comments
 (0)