mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
FIX for filterMany with raw expression with single SQL query
Fix for the case where the filterMany is not executed on a separate
query but instead part of the origin query.
The fix is to use the appropriate DeployParser and also fix the path
alias like ${} -> ${contacts}
This commit is contained in:
@@ -152,6 +152,24 @@ public class TestQueryFilterMany extends BaseTestCase {
|
||||
assertThat(sql.get(1)).contains("from o_order t0 join o_customer t1 on t1.id = t0.kcustomer_id where");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_with_findOne_rawSameQuery() {
|
||||
ResetBasicData.reset();
|
||||
|
||||
LoggedSql.start();
|
||||
var result = DB.find(Customer.class)
|
||||
.order().asc("id")
|
||||
.fetch("orders")
|
||||
.filterMany("orders").raw("orderDate is not null")
|
||||
.findList();
|
||||
|
||||
assertThat(result).isNotEmpty();
|
||||
List<String> sql = LoggedSql.stop();
|
||||
assertThat(sql).hasSize(1);
|
||||
assertThat(sql.get(0)).contains("from o_customer t0 left join o_order t1");
|
||||
assertThat(sql.get(0)).contains("where t1.order_date is not null");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_with_findOneOrEmpty() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user