#601 - Second Nested filterMany not executed but joined

This commit is contained in:
Robin Bygrave
2016-03-14 23:54:34 +13:00
parent c40715733e
commit 5216014d50
2 changed files with 23 additions and 1 deletions
@@ -11,6 +11,7 @@ import org.junit.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -40,4 +41,24 @@ public class TestQueryFilterMany extends BaseTestCase {
Ebean.refreshMany(customer, "orders");
}
@Test
public void testNestedFilterMany() {
ResetBasicData.reset();
LoggedSqlCollector.start();
Ebean.find(Customer.class)
.filterMany("contacts").isNotNull("firstName")
.filterMany("contacts.notes").istartsWith("title", "foo")
.findList();
List<String> sql = LoggedSqlCollector.stop();
assertThat(sql).hasSize(3);
assertThat(sql.get(0)).contains(" from o_customer t0; --bind()");
assertThat(sql.get(1)).contains(" from contact t0 where (t0.customer_id) in");
assertThat(sql.get(1)).contains(" and t0.first_name is not null");
assertThat(sql.get(2)).contains(" from contact_note t0 where (t0.contact_id) in");
assertThat(sql.get(2)).contains(" and lower(t0.title) like");
}
}