mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
* #1970 - Change test code only moving mapping annotations to fields First step in remove support for mapping annotations on "Getters" (so field only target for mapping annotations) * #1970 - Remove reading mapping annotations from "Getters" * #1970 - Refactor to use simple annotation lookup where possible * #1970 - Remove GenerationType.TABLE and SequenceGenerator from type/class * #1970 - Refactor meta annotation reading * #1970 - Read @Aggregation as a meta annotation
37 lines
944 B
Java
37 lines
944 B
Java
package org.tests.basic;
|
|
|
|
import io.ebean.Ebean;
|
|
import io.ebean.Query;
|
|
import io.ebean.TransactionalTestCase;
|
|
|
|
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 TestWhereAnnotation extends TransactionalTestCase {
|
|
|
|
@Test
|
|
public void testWhere() {
|
|
|
|
Customer custTest = ResetBasicData.createCustAndOrder("testWhereAnn");
|
|
|
|
Customer customer = Ebean.find(Customer.class, custTest.getId());
|
|
List<Order> orders = customer.getOrders();
|
|
|
|
Assert.assertTrue(!orders.isEmpty());
|
|
|
|
Query<Customer> q1 = Ebean.find(Customer.class).setUseCache(false).fetch("orders").where()
|
|
.idEq(1).query();
|
|
|
|
q1.findOne();
|
|
String s1 = q1.getGeneratedSql();
|
|
assertThat(s1).contains("t1.order_date is not null");
|
|
}
|
|
}
|