Skip to content

Commit 0d3e834

Browse files
committed
HHH-19964 - Allow json serialization of Object valued attribute
Signed-off-by: Jan Schatteman <jschatte@redhat.com>
1 parent fee7ed7 commit 0d3e834

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hibernate-core/src/main/java/org/hibernate/type/format/AbstractJsonFormatMapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public abstract class AbstractJsonFormatMapper implements FormatMapper {
1818
@Override
1919
public final <T> T fromString(CharSequence charSequence, JavaType<T> javaType, WrapperOptions wrapperOptions) {
2020
final Type type = javaType.getJavaType();
21-
if ( type == String.class || type == Object.class ) {
21+
if ( type == String.class ) {
2222
return (T) charSequence.toString();
2323
}
2424
return fromString( charSequence, type );
@@ -27,7 +27,7 @@ public final <T> T fromString(CharSequence charSequence, JavaType<T> javaType, W
2727
@Override
2828
public final <T> String toString(T value, JavaType<T> javaType, WrapperOptions wrapperOptions) {
2929
final Type type = javaType.getJavaType();
30-
if ( type == String.class || type == Object.class ) {
30+
if ( value instanceof String ) {
3131
return (String) value;
3232
}
3333
return toString( value, type );

0 commit comments

Comments
 (0)