diff --git a/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeBuilder.java b/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeBuilder.java index 5963b84cd..c3e3fb736 100644 --- a/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeBuilder.java +++ b/ebean-core/src/main/java/io/ebeaninternal/server/query/SqlTreeBuilder.java @@ -299,15 +299,31 @@ public final class SqlTreeBuilder { return new SqlTreeNodeRoot(desc, props, myList, withId, includeJoin, lazyLoadMany, temporalMode, disableLazyLoad, sqlDistinct, baseTable); } else if (prop instanceof STreePropertyAssocMany) { - boolean withId = isNotSingleAttribute() && !subQuery; - return new SqlTreeNodeManyRoot(prefix, (STreePropertyAssocMany) prop, props, myList, withId, temporalMode, disableLazyLoad); + return new SqlTreeNodeManyRoot(prefix, (STreePropertyAssocMany) prop, props, myList, withId(), temporalMode, disableLazyLoad); } else { - boolean withId = isNotSingleAttribute() && !subQuery; - return new SqlTreeNodeBean(prefix, prop, props, myList, withId, temporalMode, disableLazyLoad); + return new SqlTreeNodeBean(prefix, prop, props, myList, withId(), temporalMode, disableLazyLoad); } } + boolean withId() { + return isNotSingleAttribute() && !subQuery; + } + + /** + * Return true if the Id property should be excluded (as it is automatically included). + */ + private boolean excludeIdProperty() { + return query == null || !query.isSingleAttribute() && !query.isManualId(); + } + + /** + * Return true if the query is not a single attribute query. + */ + private boolean isNotSingleAttribute() { + return query == null || !query.isSingleAttribute(); + } + /** * Build extra joins to support properties used in where clause but not * already in select clause. @@ -666,20 +682,6 @@ public final class SqlTreeBuilder { } return extras.toArray(new String[0]); } - } - /** - * Return true if the Id property should be excluded (as it is automatically included). - */ - private boolean excludeIdProperty() { - return query == null || !query.isSingleAttribute() && !query.isManualId(); - } - - /** - * Return true if the query is not a single attribute query. - */ - private boolean isNotSingleAttribute() { - return query == null || !query.isSingleAttribute(); - } }