Problems combining two conditions, working separately
FlamingBone opened this issue · comments
FlamingBone commented
Hi,
here is my code:
Filter filter = new Filter();
DateTime dt = new DateTime().minusHours(1000);
DateTime dt2 = new DateTime().plusHours(1000);
System.out.println(dt.toDate());
System.out.println(dt2.toDate());
filter.addCondition("matchDate", Operator.gt, dt.toDate());
filter.addCondition("matchDate", Operator.lt, dt2.toDate());
List<PtaMatch> candidates = PtaMatch.where(filter);
System.out.println(candidates.size());
If i comment out any one of the two conditions, i receive all records in that table. if i add both condition, i always get 0 records.
btw. how do i combine two conditions with "or"?
Thank you!
FlamingBone commented
When using
filter.addCondition("matchDate", Operator.between, dates)
it works!
Still strange...
Ganesh Subramanian commented
@FlamingBone You got the solution right. Closing this.