Hi Guillem, Thanks for your message.
On Wed, Feb 7, 2024 at 9:09 AM Guillem Corominas <[email protected]> wrote: > Hi, > At my company we are using Jooq since a long time ago. > I am now migrating an old application from Java 8 to Java 11, and I was > trying to bump a 3.11 version of Jooq to the latest open-source available > for Java 11 (3.16) > > As I was saying in the title, we only use Jooq for its DSL query > generator, but we are not using the code generator. > Why not? I have to ask, because you're missing out on the best features of jOOQ, even more so when you upgrade to 3.16 https://blog.jooq.org/why-you-should-use-jooq-with-code-generation/ > I am seeing that with the prior version, Jooq mapped automatically String > into Enums, but since the upgrade it doesn't. I suppose by calling its > valueOf() method. > > Type type = record.getValue("loc_type", Type.class); > > The statement above worked fine with Java 8 and Jooq 3.11, however now > with Java 11 and Jooq 3.16 I get: > > *org.jooq.exception.DataTypeException: Cannot cast from class > java.lang.Object (instance type: class java.lang.String to class > java.lang.Object* > > Is there any way to globally activate the mapping of Strings to Enums as a > setting for all the application? > My first guess is, of course, that this is a problem that could have been avoided with code generation (see again the above article). I'm assuming you didn't provide the data type binding for your enum while constructing the query, creating just DSL.field("loc_type") without type information. And then, the information got lost somewhere. But I cannot be 100% sure. I'll need more context to answer this question, including a complete reproducer. Our issue tracker on github asks for an "MCVE" (minimal, complete, verifiable example), e.g. based on this template here: https://github.com/jOOQ/jOOQ-mcve. Sometimes, it may not be necessary to create such a complete example, but it's certainly helpful, ensuring that the exact behaviour can be reproduced. Otherwise, such emails just tend to ping-pong back and forth until it's clear what exactly you're doing. -- 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/CAB4ELO5S_pJe1hFA_iEJF%2BEf6xSyosj5_NJXduPiL3zUVvjYXQ%40mail.gmail.com.
