-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Describe the bug
Add field mapper
15:09:24.048 [main] DEBUG io.github.zero88.jooqx.datatype.DataTypeMapperRegistry - Adding field mapper by [all_data_types.f_udt_address::io.github.zero88.sample.model.pgsql.udt.records.FullAddressRecord]...
When executing query directly
final AllDataTypes table = schema().ALL_DATA_TYPES;
jooqx.execute(dsl -> dsl.selectFrom(table).where(table.ID.eq(41)).limit(1), DSLAdapter.fetchOne(table))
.onSuccess(record -> {
final FullAddressRecord address = record.getFUdtAddress();
});The record field is converted successfully.
However, executing by shortcut
final AllDataTypes table = schema().ALL_DATA_TYPES;
jooqx.fetchOne(dsl -> dsl.selectFrom(table).where(table.ID.eq(41)).limit(1))
.onSuccess(record -> {
final FullAddressRecord address = record.getFUdtAddress();
});Exception is raised
java.lang.ClassCastException: class java.lang.String cannot be cast to class io.github.zero88.sample.model.pgsql.udt.records.FullAddressRecord (java.lang.String is in module java.base of loader 'bootstrap'; io.github.zero88.sample.model.pgsql.udt.records.FullAddressRecord is in unnamed module of loader 'app')
at io.github.zero88.sample.model.pgsql.tables.records.AllDataTypesRecord.getFUdtAddress(AllDataTypesRecord.java:467)
Version
V2.0.0
Additional context
Need to re-check
DSLAdapterwithSelect.asTable()introduce table alias then the mapper is unable to look up the field- Cover alias in
DataTypeMapperandDataTypeMapperRegistry