mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
#2327 - findSingleAttribute() on a ToMany path includes the id column
Follow up refactor SqlTreeBuilder
This commit is contained in:
1 parent
bedb841fa9
commit
d4d9bb204d
1 file changed
+20
-18
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user