jOOQ 3.10 will now finally pattern-match also "unknown" types (types that 
jOOQ is not aware of, such as JSON), including user-defined types:
https://github.com/jOOQ/jOOQ/issues/5872

Am Donnerstag, 24. Oktober 2013 17:46:15 UTC+2 schrieb Lukas Eder:
>
> Hi Dmitri,
>
> Unfortunately, I have to say that not much qualifies as working as 
> expected with PostgreSQL's advanced data types and the PostgreSQL JDBC 
> driver. From my experience, there is always quite a bit of tweaking 
> involved in that area - at least before jOOQ formally supports these types.
>
> Cheers
> Lukas
>
> 2013/10/23 Dmitri Bichko <dbic...@gmail.com>
>
>> Yep, works quite well for what I need.
>>
>> Inserts / updates only work with prepared statements, with static 
>> statements I end up with just a toString() of the value (at least for 
>> hstore/HashMap, I haven't tried it with JSON), which, of course, postgres 
>> doesn't understand. I think that's expected, though?
>>
>> Dmitri
>>
>>
>> On Wed, Oct 23, 2013 at 10:50 AM, Lukas Eder <lukas.e...@gmail.com> 
>> wrote:
>>
>>> Does the patching help? I.e. does jOOQ use the correct types of bind 
>>> values?
>>>
>>>
>>> 2013/10/22 Dmitri Bichko <dbic...@gmail.com>
>>>
>>>> Thanks Lukas, I'll keep patching the generated classes for now.
>>>>
>>>> Looking forward to more Postgres support in future releases!
>>>>
>>>> Cheers,
>>>> Dmitri
>>>>
>>>>
>>>> On Thu, Oct 17, 2013 at 11:03 AM, Lukas Eder <lukas.e...@gmail.com> 
>>>> wrote:
>>>>
>>>>> 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 <dbic...@gmail.com>
>>>>>
>>>>>> 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 <dbi...@gmail.com>
>>>>>>>
>>>>>>>> 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.
>>>>>>>>
>>>>>>>
>>>>>>> -- 
>>>>>> 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+unsubscr...@googlegroups.com.
>>>>>>
>>>>>> 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 jooq-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to