mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
This commit is contained in:
@@ -23,7 +23,7 @@ public class TestM2MSoftDeleteExists extends BaseTestCase {
|
||||
|
||||
Query<MsManyA> query = Ebean.find(MsManyA.class)
|
||||
.where().isNotEmpty("manybs")
|
||||
.order("aid");
|
||||
.order("aid").query();
|
||||
|
||||
List<MsManyA> list = query.findList();
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public class TestManyWhereJoin extends BaseTestCase {
|
||||
|
||||
Query<Order> query = Ebean.find(Order.class)
|
||||
.where().eq("details.product.id", productId)
|
||||
.order("cretime asc");
|
||||
.order("cretime asc").query();
|
||||
|
||||
query.findList();
|
||||
String sql = sqlOf(query, 3);
|
||||
@@ -123,7 +123,7 @@ public class TestManyWhereJoin extends BaseTestCase {
|
||||
Query<Order> query = Ebean.find(Order.class)
|
||||
//.fetch("details")
|
||||
.where().eq("details.product", product)
|
||||
.order("cretime asc");
|
||||
.order("cretime asc").query();
|
||||
|
||||
query.findList();
|
||||
String sql = sqlOf(query, 3);
|
||||
@@ -157,7 +157,7 @@ public class TestManyWhereJoin extends BaseTestCase {
|
||||
Query<Order> query = Ebean.find(Order.class)
|
||||
.fetch("details")
|
||||
.where().eq("details.product", product)
|
||||
.order("cretime asc");
|
||||
.order("cretime asc").query();
|
||||
|
||||
query.findList();
|
||||
String sql = sqlOf(query, 3);
|
||||
|
||||
@@ -116,7 +116,8 @@ public class TestQueryFilterMany extends BaseTestCase {
|
||||
final Query<Customer> query = DB.find(Customer.class)
|
||||
.where().ieq("name", "Rob")
|
||||
// use expression + fluid style adding maxRows/firstRow to filterMany
|
||||
.filterMany("orders", "status = ?", Order.Status.NEW).setMaxRows(100).setFirstRow(3)
|
||||
.filterMany("orders", "status = ?", Order.Status.NEW)
|
||||
.setMaxRows(100).setFirstRow(3).order("orderDate desc, id")
|
||||
.order().asc("id").setMaxRows(5);
|
||||
|
||||
final List<Customer> customers = query.findList();
|
||||
@@ -129,8 +130,7 @@ public class TestQueryFilterMany extends BaseTestCase {
|
||||
if (isH2() || isPostgres()) {
|
||||
assertThat(sqlList.get(0)).doesNotContain("offset");
|
||||
assertThat(sqlList.get(0)).contains(" limit 5");
|
||||
assertThat(sqlList.get(1)).contains(" offset 3");
|
||||
assertThat(sqlList.get(1)).contains(" limit 100");
|
||||
assertThat(sqlList.get(1)).contains(" order by t0.order_date desc, t0.id limit 100 offset 3");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class TestQueryFindEach extends BaseTestCase {
|
||||
= server.find(Customer.class)
|
||||
.setAutoTune(false)
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).order("id")
|
||||
.setMaxRows(2);
|
||||
.setMaxRows(2).query();
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class TestQueryFindEach extends BaseTestCase {
|
||||
|
||||
Query<Customer> query = server.find(Customer.class).setAutoTune(false)
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).order("id")
|
||||
.setMaxRows(2);
|
||||
.setMaxRows(2).query();
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class TestQueryFindEachWhile extends BaseTestCase {
|
||||
= server.find(Customer.class)
|
||||
.setAutoTune(false)
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).order("id")
|
||||
.setMaxRows(2);
|
||||
.setMaxRows(2).query();
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TestQueryFindEachWhile extends BaseTestCase {
|
||||
|
||||
Query<Customer> query = server.find(Customer.class).setAutoTune(false)
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).order("id")
|
||||
.setMaxRows(2);
|
||||
.setMaxRows(2).query();
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
|
||||
@@ -22,8 +22,9 @@ public class TestQueryFindVisit extends BaseTestCase {
|
||||
EbeanServer server = Ebean.getServer(null);
|
||||
|
||||
Query<Customer> query = server.find(Customer.class).setAutoTune(false)
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).order("id")
|
||||
.setMaxRows(2);
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0)
|
||||
.order("id")
|
||||
.setMaxRows(2).query();
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
@@ -44,7 +45,7 @@ public class TestQueryFindVisit extends BaseTestCase {
|
||||
|
||||
Query<Customer> query = server.find(Customer.class).setAutoTune(false)
|
||||
.fetch("contacts", new FetchConfig().query(2)).where().gt("id", 0).order("id")
|
||||
.setMaxRows(2);
|
||||
.setMaxRows(2).query();
|
||||
|
||||
final AtomicInteger counter = new AtomicInteger(0);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class TestRowCount extends BaseTestCase {
|
||||
.where()
|
||||
.gt("id", 1)
|
||||
.gt("details.id", 1)
|
||||
.order("id desc");
|
||||
.order("id desc").query();
|
||||
|
||||
int rc = query.findCount();
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class TestOrderByWithDistinct extends BaseTestCase {
|
||||
.where()
|
||||
.eq("junk", "blah")
|
||||
.eq("name", "jim")
|
||||
.order("id desc,path.that.does.not.exist,contacts.group.name asc");
|
||||
.order("id desc,path.that.does.not.exist,contacts.group.name asc").query();
|
||||
|
||||
Set<String> unknownProperties = query.validate();
|
||||
assertThat(unknownProperties).isNotEmpty();
|
||||
@@ -49,7 +49,7 @@ public class TestOrderByWithDistinct extends BaseTestCase {
|
||||
Query<MUser> query = Ebean.find(MUser.class)
|
||||
.where()
|
||||
.eq("roles", role)
|
||||
.order("userName asc nulls first");
|
||||
.order("userName asc nulls first").query();
|
||||
|
||||
query.findList();
|
||||
|
||||
@@ -124,7 +124,7 @@ public class TestOrderByWithDistinct extends BaseTestCase {
|
||||
.fetch("userType", "name")
|
||||
.where()
|
||||
.eq("roles.roleName", "A")
|
||||
.order("userType.name, userName");
|
||||
.order("userType.name, userName").query();
|
||||
List<MUser> list = query.findList();
|
||||
|
||||
// select distinct t0.userid c0, t0.user_name c1, t1.id c2, t1.name c3
|
||||
@@ -158,7 +158,7 @@ public class TestOrderByWithDistinct extends BaseTestCase {
|
||||
.fetch("userType", "name")
|
||||
.where()
|
||||
.eq("roles.roleName", "A")
|
||||
.order("userType.name");
|
||||
.order("userType.name").query();
|
||||
list = query.findList();
|
||||
|
||||
Assert.assertEquals(1, list.size());
|
||||
|
||||
@@ -27,7 +27,7 @@ public class TestOrderByWithDistinctTake2 extends BaseTestCase {
|
||||
Query<Customer> query = Ebean.find(Customer.class)
|
||||
.select("id, name")
|
||||
.where().ilike("contacts.firstName", "R%")
|
||||
.order("name desc");
|
||||
.order("name desc").query();
|
||||
|
||||
query.findList();
|
||||
|
||||
@@ -55,7 +55,7 @@ public class TestOrderByWithDistinctTake2 extends BaseTestCase {
|
||||
Query<Customer> query = Ebean.find(Customer.class)
|
||||
.select("id")
|
||||
.where().ilike("contacts.firstName", "R%")
|
||||
.order("name asc,id desc");
|
||||
.order("name asc,id desc").query();
|
||||
|
||||
query.findList();
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class TestQueryConversationRowCount extends BaseTestCase {
|
||||
.endJunction()
|
||||
.eq("open", true)
|
||||
.endJunction()
|
||||
.order("whenCreated desc");
|
||||
.order("whenCreated desc").query();
|
||||
|
||||
query.findList();
|
||||
String generatedSql = sqlOf(query, 1);
|
||||
|
||||
@@ -27,7 +27,7 @@ public class TestQueryRowCountWithMany extends BaseTestCase {
|
||||
Query<Order> query = Ebean.find(Order.class)
|
||||
.fetch("details")
|
||||
.where().eq("details.product.id", productId)
|
||||
.order("cretime asc");
|
||||
.order("cretime asc").query();
|
||||
|
||||
List<Order> list = query.findList();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user