mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#601 - Second Nested filterMany not executed but joined
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user