Leverage the equal() method on the wrapped entity instead of creating a string.
Closes #11764
This commit is contained in:
parent
0d83b51b20
commit
e0d7ad1be5
1 changed files with 2 additions and 8 deletions
|
@ -258,20 +258,14 @@ public class JsonbType extends AbstractSingleColumnStandardBasicType<Object> imp
|
|||
try {
|
||||
return MAPPER.writeValueAsString(value);
|
||||
} catch (IOException e) {
|
||||
throw new HibernateException("unable to tranform value: " + value + " as String.", e);
|
||||
throw new HibernateException("unable to transform value: " + value + " as String.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areEqual(Object one, Object another) {
|
||||
if (one == another) return true;
|
||||
if (one == null || another == null) return Objects.equals(one, another);
|
||||
try {
|
||||
return MAPPER.readTree(toString(one)).equals(
|
||||
MAPPER.readTree(toString(another)));
|
||||
} catch (IOException e) {
|
||||
throw new HibernateException("unable to perform areEqual", e);
|
||||
}
|
||||
return Objects.equals(one, another);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue