mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Fix for #87 - v4 - Remove Query setBackgroundFetchAfter() feature
This commit is contained in:
@@ -1,63 +0,0 @@
|
||||
package com.avaje.tests.basic;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.Query;
|
||||
import com.avaje.ebeaninternal.api.SpiEbeanServer;
|
||||
import com.avaje.tests.model.basic.Order;
|
||||
import com.avaje.tests.model.basic.ResetBasicData;
|
||||
|
||||
public class TestBackgroundFetchAfter extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testWrtJoin() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
SpiEbeanServer server = (SpiEbeanServer)Ebean.getServer(null);
|
||||
boolean h2Db = "h2".equals(server.getDatabasePlatform().getName());
|
||||
|
||||
// limit not in sql as join to many
|
||||
Query<Order> q = Ebean.find(Order.class)
|
||||
.fetch("details")
|
||||
.setBackgroundFetchAfter(3)
|
||||
.setMaxRows(10);
|
||||
|
||||
q.findList();
|
||||
String sql = q.getGeneratedSql();
|
||||
|
||||
if (h2Db){
|
||||
Assert.assertTrue(sql.indexOf("limit") == -1);
|
||||
}
|
||||
|
||||
// allows limit use as no join to many
|
||||
q = Ebean.find(Order.class)
|
||||
.setBackgroundFetchAfter(3)
|
||||
.setMaxRows(10);
|
||||
|
||||
q.findList();
|
||||
sql = q.getGeneratedSql();
|
||||
|
||||
if (h2Db){
|
||||
Assert.assertTrue(sql.indexOf("limit") > -1);
|
||||
}
|
||||
|
||||
// allows limit use as join to one (not many)
|
||||
q = Ebean.find(Order.class)
|
||||
.fetch("customer")
|
||||
.setBackgroundFetchAfter(3)
|
||||
.setMaxRows(10);
|
||||
|
||||
q.findList();
|
||||
sql = q.getGeneratedSql();
|
||||
|
||||
if (h2Db){
|
||||
Assert.assertTrue(sql.indexOf("limit") > -1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user