mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#210 - ENH: Add Query.setLazyLoadBatch(int size) method ... for per query control
This commit is contained in:
@@ -1,35 +1,30 @@
|
||||
package com.avaje.tests.query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.Expr;
|
||||
import com.avaje.ebean.Junction;
|
||||
import com.avaje.ebean.Query;
|
||||
import com.avaje.tests.model.basic.Customer;
|
||||
import com.avaje.tests.model.basic.ResetBasicData;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TestLimitQuery extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testHasManyWithLimit() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<Customer> query = Ebean.find(Customer.class);
|
||||
query.setAutofetch(false);
|
||||
query.setFirstRow(0);
|
||||
query.setMaxRows(10);
|
||||
List<Customer> customers = Ebean.find(Customer.class)
|
||||
.setAutofetch(false)
|
||||
.setFirstRow(0)
|
||||
.setMaxRows(10)
|
||||
.where().like("name", "%A%")
|
||||
.findList();
|
||||
|
||||
Junction<Customer> junc = Expr.disjunction(query);
|
||||
junc.add(Expr.like("name", "%A%"));
|
||||
query.where(junc);
|
||||
// should at least find the "Cust NoAddress" customer
|
||||
Assert.assertTrue(customers.size() > 0);
|
||||
|
||||
List<Customer> customer = query.findList();
|
||||
Assert.assertTrue(customer.size() > 0); // should at least find the
|
||||
// "Cust NoAddress" customer
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user