#1475 - @OneToOne child with @SoftDelete that is deleted is still loaded by parent

This commit is contained in:
rob bygrave committed 2018-08-27 21:35:00 +12:00
1 parent 2df2224286
commit 55a9ba7170
9 files changed
+218 -21

No files matched your search

@@ -70,6 +70,11 @@ class DefaultDbSqlContext implements DbSqlContext {
this.fromForUpdate = fromForUpdate;
}
@Override
public boolean isIncludeSoftDelete() {
return alias.isIncludeSoftDelete();
}
@Override
public void appendFromForUpdate() {
if (fromForUpdate != null) {
@@ -99,11 +104,6 @@ class DefaultDbSqlContext implements DbSqlContext {
return encryptedProps.toArray(new BeanProperty[encryptedProps.size()]);
}
@Override
public String peekJoin() {
return joinStack.peek();
}
@Override
public void popJoin() {
joinStack.pop();
@@ -206,11 +206,6 @@ class DefaultDbSqlContext implements DbSqlContext {
return alias.getTableAliasManyWhere(prefix);
}
@Override
public void pushSecondaryTableAlias(String alias) {
tableAliasStack.push(alias);
}
@Override
public String getRelativePrefix(String propName) {
@@ -1,6 +1,7 @@
package io.ebeaninternal.server.query;
import io.ebean.util.SplitName;
import io.ebeaninternal.api.SpiQuery;
import java.util.HashMap;
import java.util.HashSet;
@@ -17,6 +18,8 @@ class SqlTreeAlias {
private static final Pattern TABLE_ALIAS_REPLACE = Pattern.compile("${}", Pattern.LITERAL);
private final SpiQuery.TemporalMode temporalMode;
private int counter;
private int manyWhereCounter;
@@ -33,8 +36,9 @@ class SqlTreeAlias {
private final String rootTableAlias;
SqlTreeAlias(String rootTableAlias) {
SqlTreeAlias(String rootTableAlias, SpiQuery.TemporalMode temporalMode) {
this.rootTableAlias = rootTableAlias;
this.temporalMode = temporalMode;
}
/**
@@ -211,4 +215,8 @@ class SqlTreeAlias {
boolean isIncludeJoins() {
return !aliasMap.isEmpty() || !manyWhereAliasMap.isEmpty();
}
boolean isIncludeSoftDelete() {
return temporalMode == SpiQuery.TemporalMode.SOFT_DELETED;
}
}
@@ -110,7 +110,7 @@ public final class SqlTreeBuilder {
this.queryDetail = query.getDetail();
this.predicates = predicates;
this.alias = new SqlTreeAlias(request.getBaseTableAlias());
this.alias = new SqlTreeAlias(request.getBaseTableAlias(), temporalMode);
this.distinctOnPlatform = builder.isPlatformDistinctOn();
String fromForUpdate = builder.fromForUpdate(query);