#1785 - Bean gets replaced on json deserialization with primitive 'null' id

This commit is contained in:
rob bygrave
2019-08-12 21:05:32 +12:00
parent ee6452cfb0
commit f5459920e9
7 changed files with 45 additions and 11 deletions
@@ -14,6 +14,8 @@ import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import static io.ebeaninternal.server.persist.DmlUtil.isNullOrZero;
class BeanDescriptorJsonHelp<T> {
private final BeanDescriptor<T> desc;
@@ -158,7 +160,7 @@ class BeanDescriptorJsonHelp<T> {
}
Object contextBean = null;
Object id = desc.beanId(bean);
if (id != null) {
if (!isNullOrZero(id)) {
// check if the bean has already been loaded
contextBean = readJson.persistenceContextPutIfAbsent(id, bean, desc);
}