I’m just getting started with db4o in a scheduling application and I’m looking for an efficient way to retrieve rooms which are not booked between certain dates.
So, I have a collection of Room objects each of which has a collection of Booking objects (which can be empty). A Booking has a start date and and end date. I want to say ‘get all the rooms that have no Bookings between DateA and DateB’.
I’m sure I could do this using a Native Query but since there’s a date range involved (my understanding is date ranges aren’t optimzed for NQ) and I need to do this query very frequently (many times per second for potentially more 10,000 rooms – the majority of which have no Bookings) I’m looking for more efficient alternatives.
Is there a way to phrase this using SODA?
Or a better way to arrange my data model to get round this issue?
Yes you can do this by using SODA Query
Query for all of the rooms which do not have a booking between fromDate and toDate
See Also : Building SODA Queries