'Converter issue with jOOQ when mapping nested records

I have two basically identical queries, one using multiset and the other using row, but they behave differently with regard to converting from SQL datatype to Java/Kotlin.

For example, here's the multiset:

multiset(
    select(
        CALENDAR_ENTRIES.ID,
        CALENDAR_ENTRIES.EVENT_DATE
    )
        .from(CALENDAR_ENTRIES)
        .where(cond)
).`as`("calendar_entry")
    .convertFrom { r: Result<Record2<Long, LocalDateTime>> ->
        r.map(
            Records.mapping { id: Long?, eventDate: LocalDateTime? ->
                CalendarEntry(id, eventDate!!)
            }
        )
    }

and here's the row:

row(
    CALENDAR_ENTRIES.ID,
    CALENDAR_ENTRIES.EVENT_DATE
)
    .mapping { id: Long?, eventDate: LocalDateTime ->
        CalendarEntry(id, eventDate)
    }

For argument's sake, assuming the DB has 1 record, with eventDate being (as a String) '2022-02-21 09:30:00'.

With the first query, I successfully get my Field<List<CalendarEntry>> instance. With the second query (row()), I get "java.time.format.DateTimeParseException: Text '2022-02-21 09:30:00' could not be parsed at index 10".

It seems that jOOQ is able to correctly apply a converter for the multiset call, but not the row call. Am I doing something wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source