#2238 - Select with disjunction of expressions over OneToOne relationship missing join clause

Noting that there might be a better fix. The addJoin() at line 151 is suppressed as it is a duplicate for this case of a !oneToOneExported so a better fix might be to only add the soft delete clause when the join as actually added (not suppressed as a duplicate).
This commit is contained in:
rbygrave
2021-06-04 17:16:50 +12:00
parent 16832ac67a
commit 6697aecd48
2 changed files with 10 additions and 3 deletions
@@ -3,12 +3,14 @@ package org.tests.softdelete;
import io.ebean.BaseTestCase;
import io.ebean.DB;
import io.ebean.Ebean;
import org.ebeantest.LoggedSqlCollector;
import org.tests.model.softdelete.ESoftDelMid;
import io.ebean.Finder;
import org.junit.Test;
import org.tests.model.softdelete.ESoftDelY;
import org.tests.model.softdelete.ESoftDelZ;
import java.util.List;
import java.util.UUID;
import static org.assertj.core.api.Assertions.assertThat;
@@ -44,6 +46,8 @@ public class TestSoftDeleteOptionalRelationship extends BaseTestCase {
DB.save(y);
}
LoggedSqlCollector.start();
Finder<Long, ESoftDelY> finder = new Finder<>(ESoftDelY.class);
ESoftDelY bean = finder
.query()
@@ -53,7 +57,10 @@ public class TestSoftDeleteOptionalRelationship extends BaseTestCase {
.findOne();
assertThat(bean).isNotNull();
final List<String> sql = LoggedSqlCollector.stop();
assertThat(sql).hasSize(1);
assertThat(sql.get(0)).contains("left join esoft_del_z t1 on t1.id = t0.organization_id and t1.deleted = false where");
}
}