是的,您可以使用 SODA Query 来做到这一点
Date fromDate = null ; // assign reservation start dat
Date toDate = null ; // assign reservation upto
Query query = db.query();
query.constrain(Booking.class);
query.descend ("fromDate").constrain ( fromDate ).greater().equal ().
and (query.descend ("toDate").constrain (toDate).smaller().equal());
ObjectSet<Booking> objectSet = query.execute();
查询fromDate 和 toDate 之间没有预订的所有房间
Query query = db.query();
query.constrain(Room.class);
query.descend ("bookingStartDate").constrain ( fromDate ).greater().equal ().and
(query.descend ("bookingEndDate").constrain (toDate).smaller().equal()).not();
ObjectSet<Room> objectSet = query.execute();
另请参阅: 构建 SODA 查询