mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1080 - NOT IN expression using entity beans / reference beans uses "in"
This commit is contained in:
@@ -6,11 +6,12 @@ import io.ebean.Query;
|
||||
import org.tests.model.basic.Customer;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestQueryInAssocOne extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
@@ -25,8 +26,23 @@ public class TestQueryInAssocOne extends BaseTestCase {
|
||||
query.findList();
|
||||
String sql = query.getGeneratedSql();
|
||||
|
||||
Assert.assertTrue(sql, sql.contains("join o_customer t1 on t1.id = t0.kcustomer_id"));
|
||||
Assert.assertTrue(sql, sql.contains("t0.kcustomer_id in (?"));
|
||||
assertThat(sql).contains("join o_customer t1 on t1.id = t0.kcustomer_id");
|
||||
assertThat(sql).contains("t0.kcustomer_id in (?");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_notIn() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
List<Customer> list = Ebean.find(Customer.class).where().lt("id", 200).findList();
|
||||
|
||||
Query<Order> query = Ebean.find(Order.class).where().notIn("customer", list).query();
|
||||
|
||||
query.findList();
|
||||
String sql = query.getGeneratedSql();
|
||||
|
||||
assertThat(sql).contains("join o_customer t1 on t1.id = t0.kcustomer_id");
|
||||
assertThat(sql).contains("t0.kcustomer_id not in (?");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user