firatgursoy / fluentquery

FluentQuery is a sql query builder by using java 8 functional interfaces and spring's JdbcTemplate.
Apache License 2.0
5 stars 0 forks source link

date mapping for params #22

Closed firatgursoy closed 3 years ago

firatgursoy commented 3 years ago

Database drivers not supporting after new time api also not recommend. I offer LocateDateTime now.

https://programminghints.com/2017/05/still-using-java-util-date-dont/

    @Test
    void localDateTimeParamAndValueTest(){
        Map<Long, LocalDateTime> map = factory.newQuery()
                .append("select i.id, i.updated from invoice i")
                .append("where i.updated > :updated", "updated", LocalDateTime.now().minusHours(5))
                .extract(Extractors.newHashMapExtractor(Long.class, LocalDateTime.class));
        Assertions.assertFalse(map.isEmpty());
    }