Skip to content

Commit 00fd577

Browse files
committed
HHH-19596 Additional fix for 6.6 backport
1 parent 792e562 commit 00fd577

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,9 @@ private static String unescape(CharSequence string, int start, int end) {
11561156
@Override
11571157
public Object createJdbcValue(Object domainValue, WrapperOptions options) throws SQLException {
11581158
assert embeddableMappingType != null;
1159+
if (domainValue == null) {
1160+
return null;
1161+
}
11591162
final StringBuilder sb = new StringBuilder();
11601163
serializeStructTo( new PostgreSQLAppender( sb ), domainValue, options );
11611164
return sb.toString();

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ public static Object[] getJdbcValues(
105105
WrapperOptions options) throws SQLException {
106106
final int jdbcValueCount = embeddableMappingType.getJdbcValueCount();
107107
final int valueCount = jdbcValueCount + ( embeddableMappingType.isPolymorphic() ? 1 : 0 );
108+
if (domainValue == null) {
109+
return null;
110+
}
108111
final Object[] values = embeddableMappingType.getValues( domainValue );
109112
final Object[] jdbcValues;
110113
if ( valueCount != values.length || orderMapping != null ) {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,13 @@ public Object createJdbcValue(Object domainValue, WrapperOptions options) throws
141141
domainValue,
142142
options
143143
);
144-
return options.getSession()
144+
return jdbcValues == null
145+
? null
146+
: options.getSession()
145147
.getJdbcCoordinator()
146148
.getLogicalConnection()
147149
.getPhysicalConnection()
148-
.createStruct( typeName, jdbcValues );
150+
.createStruct(typeName, jdbcValues);
149151
}
150152

151153
@Override

0 commit comments

Comments
 (0)