#2179 - Improved fix for (2179) Fetch on nested one-to-many collections results in duplicates

The improvement here is that SqlTreeNodeManyRoot uses load and isContextBean() so that it only checks if the collection already contains the detailBean if the detailBean was already in the persistence context (aka not newly loaded and added).  The vast majority case is that detailBean is loaded fresh so for the common case we can skip the extra collection contains() check.
This commit is contained in:
Robin Bygrave committed 2021-03-01 20:27:50 +13:00
1 parent 5a73c85e6e
commit 297c1d7abb
3 files changed
+41 -25

No files matched your search

@@ -70,9 +70,8 @@ public final class BeanSet<E> extends AbstractBeanCollection<E> implements Set<E
@Override
public void internalAddWithCheck(Object bean) {
if (set == null || bean == null || !set.contains(bean)) {
internalAdd(bean);
}
// set add() already de-dups so just add it
internalAdd(bean);
}
@Override