Hello Dmitri,

I'm sorry for the delay. I was able to reproduce this. There's actually
quite a simple explanation for this. Forcing "unknown" types is simply not
supported by jOOQ, right now. There are two things to be done:

Adding support for the PostgreSQL json data type:
https://github.com/jOOQ/jOOQ/issues/2788

Adding support for type rewriting when the "base" type is unknown to jOOQ:
https://github.com/jOOQ/jOOQ/issues/2789

I'm afraid I currently don't see an easy workaround short of:
- Patching the code generator at your side
- Patching the generated classes manually, at your side

Cheers
Lukas

2013/10/8 Dmitri Bichko <[email protected]>

> jOOQ 3.1.0
>
> The actual table is:
>
> CREATE SEQUENCE task_seq;
> CREATE TABLE task (
>   task_id   int4 PRIMARY KEY DEFAULT nextval('task_seq'),
>   type      varchar(16) NOT NULL CHECK (type IN ('check', 'parse',
> 'index', 'merge', 'score', 'clear', 'store', 'stats')),
>   status    varchar(16) NOT NULL CHECK (status IN ('wait', 'exec', 'done',
> 'fail', 'stop')),
>   parent_id int4 REFERENCES task (task_id) ON DELETE CASCADE DEFERRABLE
> INITIALLY DEFERRED,
>   batch_id  int4 REFERENCES batch (batch_id) ON DELETE CASCADE DEFERRABLE
> INITIALLY DEFERRED,
>   search_id int4 REFERENCES search (search_id) ON DELETE CASCADE
> DEFERRABLE INITIALLY DEFERRED,
>   input     json,
>   submitted timestamptz NOT NULL,
>   initiated timestamptz,
>   completed timestamptz
> );
> ALTER SEQUENCE litms.task_seq OWNED BY litms.task.task_id;
> CREATE INDEX task_queue ON litms.task (type, submitted)
>   WHERE status = 'wait';
>
> 'input' is the forced field. I get the same behavior with other columns
> and types, too.
>
> Thanks,
> Dmitri
>
>
> On Tuesday, October 8, 2013 9:04:22 AM UTC-4, Lukas Eder wrote:
>
>> This could be a bug. What jOOQ version are you using? Could you provide
>> me with the DDL for the myschema.table?
>>
>> Cheers
>> Lukas
>>
>>
>> 2013/10/8 <[email protected]>
>>
>>> Hi,
>>>
>>> I'm having a problem where if I configure forcedTypes, the field type is
>>> set correctly, but the associated converter is not applied.
>>>
>>> Here is my configuration:
>>>
>>>   <generator>
>>>     <database>
>>>       <name>org.jooq.util.postgres.**PostgresDatabase</name>
>>>       <includes>.*</includes>
>>>       <excludes></excludes>
>>>       <inputSchema>myschema</**inputSchema>
>>>       <customTypes>
>>>         <customType>
>>>           <name>com.fasterxml.jackson.**databind.node.ObjectNode</**
>>> name>
>>>           <converter>com.mystuff.**JsonConverter</converter>
>>>         </customType>
>>>       </customTypes>
>>>       <forcedTypes>
>>>         <forcedType>
>>>           <name>com.fasterxml.jackson.**databind.node.ObjectNode</**
>>> name>
>>>           <expressions>myschema\.table\.**foo|myschema\.table\.bar</**
>>> expressions>
>>>         </forcedType>
>>>       </forcedTypes>
>>>     </database>
>>>     <strategy><name>com.mystuff.**PrefixGeneratorStrategy</name>**
>>> </strategy>
>>>     <generate>
>>>       <records>false</records>
>>>     </generate>
>>>     <target>
>>>       <packageName>com.mystuff.sql</**packageName>
>>>       <directory>src/</directory>
>>>     </target>
>>>   </generator>
>>>
>>> The fields are generated thusly:
>>>
>>>     public final org.jooq.TableField<org.jooq.**Record,
>>> com.fasterxml.jackson.**databind.node.ObjectNode> FOO =
>>> createField("foo", 
>>> org.jooq.impl.DefaultDataType.**getDefaultDataType("json"),
>>> this);
>>>
>>> Which, of course, doesn't compile. I have to manually add the 
>>> .asConvertedDataType(new
>>> JsonConverter())
>>>
>>> What am I doing wrong?
>>>
>>> Thanks,
>>> Dmitri
>>>
>>> --
>>> 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/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>
>>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.

Reply via email to