Hi Lukas, An existing enum is generated and it works fine. However, I want to map to an Enum defined in an external package.
Thanks On Sunday, June 19, 2016 at 7:04:52 PM UTC+1, Lukas Eder wrote: > > Hmm, the interesting thing here is to see why the MOOD enum type is not > generated. Did you perhaps exclude it from the code generation? Or is it in > a different schema? jOOQ supports PostgreSQL enum types and enum type > arrays out of the box, which is why I'm asking... > > Lukas > > 2016-06-18 2:29 GMT+01:00 Emrul Islam <[email protected] <javascript:>>: > >> Oops, cut & paste error - my MoodConverter is so: >> >> public class MoodConverter extends EnumConverter<String, Mood> { >> public MoodConverter() { >> super(String.class, Mood.class); >> } >> } >> >> >> On Saturday, June 18, 2016 at 2:25:44 AM UTC+1, Emrul Islam wrote: >>> >>> Hi, >>> >>> I am using Postgres and have the following schema: >>> >>> CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy'); >>> >>> CREATE TABLE test_enum_array >>> ( >>> "eArray" mood[] >>> ) >>> >>> In my Jooq codegen config I have the following: >>> >>> <customTypes> >>> <customType> >>> <name>Mood</name> >>> <type>org.test.enums.Mood</type> >>> <converter>org.test.db.util.MoodConverter</converter> >>> </customType> >>> </customTypes> >>> <forcedTypes> >>> <forcedType> >>> <name>Mood</name> >>> <expression>eArray</expression> >>> </forcedType> >>> </forcedTypes> >>> >>> >>> The generated code looks like this: >>> >>> public final >>> TableField<org.test.db.jooq.shared.tables.records.test_enum_array, Mood[]> >>> eArray = createField("eArray", >>> org.jooq.impl.DefaultDataType.getDefaultDataType("org.test.enums.Mood").getArrayDataType(), >>> this, "", new MoodConverter()); >>> >>> >>> My MoodConverter is like so: >>> >>> public class MoodConverter extends EnumConverter<String, Mood> { >>> public BaseTypeIdConverter() { >>> super(String.class, Mood.class); >>> } >>> } >>> >>> >>> But IntelliJ throws up a 'Cannot resolve method' IDE warning. >>> >>> I can see that MoodConverter requires a string but appears to be getting >>> passed the entire array so that's clearly wrong. However, I'm not clear on >>> how to configure Jooq to give me the result I want. >>> >>> Thanks! >>> >> -- >> 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] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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]. For more options, visit https://groups.google.com/d/optout.
