I am using jooq in my project and I need to request some data between two dates.
A sql query that produces the correct data,
select created_on from queue_token where created_on between '2015-07-16' and '2015-07-17' and token_queue_id=1;
equivalent jooq-request, which I wrote below, but does not give the required result
create.select().from(com.database.tables.QueueToken.QUEUE_TOKEN) .where(com.database.tables.QueueToken.QUEUE_TOKEN.TOKEN_QUEUE_ID.equal(1)) .and(com.database.tables.QueueToken.QUEUE_TOKEN.CREATED_ON.between(new Timestamp(fromDate.getTime())).and(new Timestamp(toDate.getTime()))) .fetch();
A jooq query produces a result, but only produces records that exactly match the fromDate value. So basically this does not work for a date range.
Can anyone help here?
source share