Emrul Islam
2016-06-18 01:25:43 UTC
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!
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 jooq-user+***@googlegroups.com.
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 jooq-user+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.