Thanks for your link, David. I confirm that seems to be the same issue. The Field.cast() expression should not have worked prior to 3.12. The fact that it did was an "accident".
- Lukas On Thu, Jan 9, 2020 at 11:04 PM David Karlsen <[email protected]> wrote: > I think that's the same issue I encountered - see this post: > https://groups.google.com/d/msg/jooq-user/ow72fRmHXHg/VlJ7aBXqAQAJ > > tor. 9. jan. 2020 kl. 20:15 skrev <[email protected]>: > >> I started to migrate a project today from 3.11.11 to 3.12.3 and got some >> test failures. I think I tracked it down to this check >> <https://github.com/jOOQ/jOOQ/blob/version-3.11.11/jOOQ/src/main/java/org/jooq/impl/AbstractField.java#L261-L262> >> no longer existing in 3.12.3 Specifically we have a >> DefaultRecordListener that sets our standard created_at and modified_at >> fields on a record. This snippet kind of shows what we are doing: >> >> private void setFieldToNow(final Record record, final String fieldName) { >> final Field<?> field = record.field(fieldName); >> if (null != field) { >> final Field<DateTime> fieldToSet = field.cast(DateTime.class); >> record.setValue(fieldToSet, getNowUTC()); >> } >> } >> >> In version 3.12.3, when it calls record.setValue it returns the following >> error: >> >> java.lang.IllegalArgumentException: Field (cast("public"."person". >> "modified_at" as timestamp)) is not contained in Row >> >> When I switch it back to 3.11.11, I do not receive this error and my >> tests pass. >> >> I'm pretty sure I can just workaround this issue by doing the following, >> but I wanted you to be aware. >> >> final Field<DateTime> fieldToSet = (Field<DateTime>)field; >> record.setValue(fieldToSet, getNowUTC()); >> >> Thanks, >> James Lorenzen >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jOOQ User Group" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jooq-user/70b7884a-c60a-4160-acbf-e114c09b1be2%40googlegroups.com >> <https://groups.google.com/d/msgid/jooq-user/70b7884a-c60a-4160-acbf-e114c09b1be2%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > -- > David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen > > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jooq-user/CAGO7Ob0VZeD8kjRjAMm4MvvjKSJP85d%2BYcmy8qAs8PzX5boSCQ%40mail.gmail.com > <https://groups.google.com/d/msgid/jooq-user/CAGO7Ob0VZeD8kjRjAMm4MvvjKSJP85d%2BYcmy8qAs8PzX5boSCQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO6mf9N9zyGBKLjXr8ZbusjBb58bnZ8FS8R%2B5h4w4C-XWQ%40mail.gmail.com.
