How to passe datetime field into queryBuilder

Yow7 years ago

Hi i want to passe datetime value into querybuilder but it gives me an error heres the methode:

public Collection<TimeLine> getDataTime(long deviceId, DateTime firstDate,DateTime lastDate) throws SQLException {
        return QueryBuilder.create(dataSource, getQuery("database.selectMapDataOfSelected"))
                .setLong("deviceId", deviceId)
                .setDateTime("firstDate", firstDate)
                .setDateTime("lastDate", lastDate)
                .executeQuery(TimeLineItemSelectedSTG.class);
    }

setDateTime doesnt exist in the query builder how cna resolve this problem??

Anton Tananaev7 years ago

You need to call "setDate". Please study the code before asking questions like this.

Yow7 years ago

you didnt understant what i wanted to say..i meant quryBuider dosnt support setDatetime...(in case we want to passe a datetime value..) anyway i solve the problem..thanks

Anton Tananaev7 years ago

No, I think you don't understand something. There is no DateTime type is Java. Date object contains both date and time.