Thanks a lot. I'll look into the MCVE as soon as possible. On Fri, Nov 6, 2020 at 4:38 PM Maurizio <[email protected]> wrote:
> I'll make a MCVE of this issue, too. I expect this one should be easier, > because I think I understand what is happening, at least partially. > > Thanks, > > Maurizio. > > On Friday, 6 November 2020 at 16:37:18 UTC+1 Maurizio wrote: > >> I'm just using import alias: >> >> *import x.y.z.jooq.tables.pojos.Beats as BeatsPojo* >> >> because I didn't learn how to configure the code generation, yet, and I >> already planned to switch to the Kotlin code generation. >> >> I should really use *typealias*es, though. You are right. >> >> >> On Thursday, 5 November 2020 at 15:17:25 UTC+1 [email protected] wrote: >> >>> My assumption here was that by "alias" you meant "typealias" like this: >>> >>> public typealias X = Pojo >>> >>> >>> On Thu, Nov 5, 2020 at 3:16 PM Lukas Eder <[email protected]> wrote: >>> >>>> Thanks again for your report. I can't reproduce this. As mentioned in >>>> the other issue, can you please provide an MCVE ( >>>> https://github.com/jOOQ/jOOQ-mcve). Also, jOOQ 3.14 has a >>>> KotlinGenerator, but I'm assuming you're not using that, because in the >>>> other issue, you're on jOOQ 3.13 and you're probably using the >>>> JavaGenerator. >>>> >>>> Thanks, >>>> Lukas >>>> >>>> On Fri, Oct 30, 2020 at 1:02 PM Maurizio <[email protected]> wrote: >>>> >>>>> 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 >>>>> <https://groups.google.com/d/msgid/jooq-user/82f39041-7e0d-4eab-9a20-2b426a0fedb3n%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 on the web visit > https://groups.google.com/d/msgid/jooq-user/be1a2bd7-9dfa-489e-95eb-bfedd144b70an%40googlegroups.com > <https://groups.google.com/d/msgid/jooq-user/be1a2bd7-9dfa-489e-95eb-bfedd144b70an%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 on the web visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO4KQzTW_zBi3abe2XEAF0_rMoM%3D1iiv1BrweMAHoPAqvw%40mail.gmail.com.
