mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
initial add of EbeanORM server based on v2.8.1
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.avaje.tests.basic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.Query;
|
||||
import com.avaje.tests.model.basic.Customer;
|
||||
import com.avaje.tests.model.basic.Order;
|
||||
import com.avaje.tests.model.basic.ResetBasicData;
|
||||
|
||||
public class TestWhereAnnotation extends TestCase {
|
||||
|
||||
public void testWhere() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
Customer custTest = ResetBasicData.createCustAndOrder("testWhereAnn");
|
||||
|
||||
Customer customer = Ebean.find(Customer.class, custTest.getId());
|
||||
List<Order> orders = customer.getOrders();
|
||||
|
||||
Assert.assertTrue(orders.size() > 0);
|
||||
|
||||
|
||||
Query<Customer> q1 = Ebean.find(Customer.class)
|
||||
.setUseCache(false)
|
||||
.fetch("orders")
|
||||
.where().idEq(1)
|
||||
.query();
|
||||
|
||||
q1.findUnique();
|
||||
String s1 = q1.getGeneratedSql();
|
||||
Assert.assertTrue(s1.contains("t1.order_date is not null"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user