mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#835 - A query that includes a fetch() of a many that is @SoftDelete where all the rows are soft deleted returns incorrect results
This commit is contained in:
@@ -494,9 +494,6 @@ public class SqlTreeNodeBean implements SqlTreeNode {
|
||||
if (desc.isSoftDelete()) {
|
||||
query.addSoftDeletePredicate(desc.getSoftDeletePredicate(baseTableAlias));
|
||||
}
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
children[i].addSoftDeletePredicate(query);
|
||||
}
|
||||
}
|
||||
|
||||
public void addAsOfTableAlias(SpiQuery<?> query) {
|
||||
@@ -522,6 +519,16 @@ public class SqlTreeNodeBean implements SqlTreeNode {
|
||||
*/
|
||||
public SqlJoinType appendFromBaseTable(DbSqlContext ctx, SqlJoinType joinType) {
|
||||
|
||||
SqlJoinType sqlJoinType = appendFromAsJoin(ctx, joinType);
|
||||
if (desc.isSoftDelete()) {
|
||||
// add the soft delete predicate to the join clause
|
||||
ctx.append("and ").append(desc.getSoftDeletePredicate(ctx.getTableAlias(prefix))).append(" ");
|
||||
}
|
||||
return sqlJoinType;
|
||||
}
|
||||
|
||||
private SqlJoinType appendFromAsJoin(DbSqlContext ctx, SqlJoinType joinType) {
|
||||
|
||||
if (nodeBeanProp instanceof BeanPropertyAssocMany<?>) {
|
||||
BeanPropertyAssocMany<?> manyProp = (BeanPropertyAssocMany<?>) nodeBeanProp;
|
||||
if (manyProp.isManyToMany()) {
|
||||
|
||||
Reference in New Issue
Block a user