I have managed to get it to work, only tested it for one level of nesting:
@SuppressWarnings("unchecked")
public static <T> T get(Record record, Field<?> field) {
if (field instanceof TableField<?,?>) return (T) field.get(record);
Name[] parts = field.getQualifiedName().parts();
Record current = record;
for (int i = 1; i < parts.length; i++) {
Name part = parts[i];
Field<?> currentField = current.field(part);
if (currentField instanceof UDTPathField<?,?,?> udtPath) {
current = current.get(udtPath, UDTRecord.class);
} else {
return (T) current.get(currentField);
}
}
throw new IllegalStateException();
}
I'm using a converter with my UDTs(through forcedTypes) so a normal
Record::get would return the user type, which is not a record. To
workaround this I force the conversion using Record::get(Field, Class), for
this to work you need to add the following to your ConverterProvider:
if (UDTRecord.class.isAssignableFrom(uType)) {
for (Converter<?, ?> converter : converters) {
if (converter.toType().equals(tType) &&
UDTRecord.class.isAssignableFrom(converter.fromType())) {
return converter.inverse();
}
}
}
where 'converters' is a list of your UDT converter.
On Fri, Feb 13, 2026 at 7:01 PM Omar Aloraini <[email protected]>
wrote:
> Not sure if this is suppose to work or not.
>
> Assume I have a table A with a UDT field b of type B and that B has a
> field C of type String. The following doesn't work:
>
> ARecord rec = ...;
> rec.get(A.B.C) => exception: field not contained in row type..
>
> I found this https://github.com/jOOQ/jOOQ/issues/16721 but not sure if
> it's the same.
>
> I debugged my code and the full path of the field as available at runtime
> "a"."b"."c". I going to experiment with getQualifiedName and breakdown
> the name and do the nested access manually.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "jOOQ User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jooq-user/H1WB-i8q-cI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/jooq-user/e65ab2db-b895-48e9-8e1c-c7363ae12a5an%40googlegroups.com
> <https://groups.google.com/d/msgid/jooq-user/e65ab2db-b895-48e9-8e1c-c7363ae12a5an%40googlegroups.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 visit
https://groups.google.com/d/msgid/jooq-user/CAJ0wWSiNSA9HG%3DmcvC_fD9h%3DNXMRx%3DEAKnk-to2MZYB5pU781w%40mail.gmail.com.