I've just started with db4o and I stumbled on to a problem.
I have an object with a subobject (it is probably not the correct word but I hope you get what I mean).
The subobject contains two dates, one start date and one end date.
I would like to show the main object if it has at least one sub object where DateTime.Now is inbetween the start and end date.
I have to use native query or SODA (linq isn't working in the project).
Thanks in advance!
I would try something like this:
IQuery query = db.Query(); query.Constrain(typeof(YourObjectType)); IConstraint constr1 = query.Descend("enddate") .Constrain(DateTime.Now).Greater(); IConstraint constr2 = query.Descend("startdate") .Constrain(DateTime.Now).Smaller(); query.Constrain(constr1).And(constr2); IObjectSet result = query.Execute();