mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1611 - ENH: Add inRange expression (as half open expression) ... (property >= lowerValue and property < upperValue)
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package org.tests.basic;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.Ebean;
|
||||
import io.ebean.Query;
|
||||
import org.junit.Test;
|
||||
import org.tests.model.basic.Order;
|
||||
import org.tests.model.basic.ResetBasicData;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class TestQueryWhereInRange extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void inRange() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
Query<Order> query= Ebean.find(Order.class)
|
||||
.where().inRange("orderDate", today.minusDays(7), today)
|
||||
.isNotNull("id")
|
||||
.query();
|
||||
|
||||
query.findList();
|
||||
|
||||
sqlOf(query).contains("(order_date >= ? and order_date < ?)");
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user