Hello, again.
I have some more insight.
The exception is thrown here:
*if (value instanceof Collection && List.class.isAssignableFrom(mType)) {
Class componentType = (Class) ((ParameterizedType)
member.getGenericType()).getActualTypeArguments()[0]; member.set(result,
Convert.convert((Collection) value, componentType));}*
in *DefaultRecordMapper.java*.
member is of an interface type which also implements a List type.
* member.getGenericType()* returns the non-generic interface type which has
no actual type arguments, and this causes the exception. I have no idea why
this didn't happen before the refactoring. As the same interface with the
same declaration was in use for some time.
I still don't know how to fix the issue, though.
Maurizio.
On Friday, 30 October 2020 at 10:19:48 UTC+1 Maurizio wrote:
> Hello.
>
> After a refactoring session, which included moving some classes like
> BeatsId in another module, this code
>
>
>
> *fun DSLContext.load(beatsId: BeatsId): BeatsPojo
> =selectFrom(BEATS).where(BEATS.BEATS_ID.eq(beatsId))
> .fetchOneInto(BeatsPojo::class.java)*
>
> causes
>
>
> *org.jooq.exception.MappingException: An error ocurred when mapping record
> to class x.y.z..jooq.tables.pojos.Beats*
>
> *java.lang.ClassCastException: class java.lang.Class cannot be cast to
> class java.lang.reflect.ParameterizedType (java.lang.Class and
> java.lang.reflect.ParameterizedType are in module java.base of loader
> 'bootstrap')*
>
> Where BeatsPojo is an alias for the pojo generated by jooq (
> *x.y.z..jooq.tables.pojos.Beats)*.
>
> However, this code runs successfully:
>
>
>
>
>
>
>
>
>
> *selectFrom(BEATS).where(BEATS.BEATS_ID.eq(beatsId)) .fetchOne().map {
> BeatsPojo( it[BEATS.BEATS_ID], it[BEATS.PARENT_BEATS_ID],
> it[BEATS.TRACK_ID], it[BEATS.FRAME_INDICES], it[BEATS.CREATOR_USER_ID],
> it[BEATS.CREATION_TIMESTAMP] )*
> I assume this is some kind of reflection problem. What can be the missing
> type? The dependencies *look *OK, to me, but I have no other ideas beyond
> that.
>
> Other pojos work just fine.
>
> Only two pojos cause this kind of problem and both have a field of array
> type. In both cases the type of the element of the array is converted using
> a org.jooq.Converter. This is not changed during the refactoring.
>
> Could you help me understand what is happening?
>
> Thanks,
>
> Maurizio.
>
--
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/82f39041-7e0d-4eab-9a20-2b426a0fedb3n%40googlegroups.com.