mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
ToMany collections that are not loaded on freeze are marked unloaded
They are marked as unloaded which means accessing the collection will throw a PersistenceException. e.g. customer.getOrders() will throw PersistenceException rather than return an empty list.
This commit is contained in:
@@ -46,7 +46,8 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
|
||||
|
||||
@Override
|
||||
public Object freeze() {
|
||||
return list == null ? Collections.emptyList() : Collections.unmodifiableList(list);
|
||||
// null -> illegal to access reference collection
|
||||
return list == null ? null : Collections.unmodifiableList(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,7 +39,8 @@ public final class BeanMap<K, E> extends AbstractBeanCollection<E> implements Ma
|
||||
|
||||
@Override
|
||||
public Object freeze() {
|
||||
return map == null ? Collections.emptyMap() : Collections.unmodifiableMap(map);
|
||||
// null -> illegal to access reference collection
|
||||
return map == null ? null : Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,7 +42,8 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
|
||||
|
||||
@Override
|
||||
public Object freeze() {
|
||||
return set == null ? Collections.emptySet() : Collections.unmodifiableSet(set);
|
||||
// null -> illegal to access reference collection
|
||||
return set == null ? null : Collections.unmodifiableSet(set);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user