#2327 - findSingleAttribute() on a ToMany path includes the id column

This commit is contained in:
rbygrave committed 2021-08-24 14:31:30 +12:00
1 parent b392db866c
commit c4c4663144
3 files changed
+6 -5

No files matched your search

@@ -299,10 +299,10 @@ public final class SqlTreeBuilder {
return new SqlTreeNodeRoot(desc, props, myList, withId, includeJoin, lazyLoadMany, temporalMode, disableLazyLoad, sqlDistinct, baseTable);
} else if (prop instanceof STreePropertyAssocMany) {
return new SqlTreeNodeManyRoot(prefix, (STreePropertyAssocMany) prop, props, myList, temporalMode, disableLazyLoad);
boolean withId = isNotSingleAttribute() && !subQuery;
return new SqlTreeNodeManyRoot(prefix, (STreePropertyAssocMany) prop, props, myList, withId, temporalMode, disableLazyLoad);
} else {
// do not read Id on child beans (e.g. when used with fetch())
boolean withId = isNotSingleAttribute() && !subQuery;
return new SqlTreeNodeBean(prefix, prop, props, myList, withId, temporalMode, disableLazyLoad);
}
@@ -13,8 +13,8 @@ final class SqlTreeNodeManyRoot extends SqlTreeNodeBean {
private final STreePropertyAssocMany manyProp;
SqlTreeNodeManyRoot(String prefix, STreePropertyAssocMany prop, SqlTreeProperties props, List<SqlTreeNode> myList,
SpiQuery.TemporalMode temporalMode, boolean disableLazyLoad) {
super(prefix, prop, props, myList, true, temporalMode, disableLazyLoad);
boolean withId, SpiQuery.TemporalMode temporalMode, boolean disableLazyLoad) {
super(prefix, prop, props, myList, withId, temporalMode, disableLazyLoad);
this.manyProp = prop;
}