ActiveJpa / activejpa

A simple active record pattern library in java that makes programming DAL easier

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems combining two conditions, working separately

FlamingBone opened this issue · comments

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!

When using
filter.addCondition("matchDate", Operator.between, dates)
it works!
Still strange...

@FlamingBone You got the solution right. Closing this.