Hi Lukas,

Thanks for explanation, I didn't realize forcedTypes configuration acted 
like a rule engine. So I thought it would be cool if the JavaGenerator, was 
doing 
    final String type = getStrategy().getJavaMemberType(column)
instead of 
    final String type = getJavaType(column.getType());
I would be able to overrid getJavaMemberType and implement my own rules. 

Well, at the moment forcedTypes should do the trick, provided I manage to 
make them work, I followed the documentation here 
http://www.jooq.org/doc/3.2/manual/code-generation/custom-data-types/ but I 
can't get it work, even on MySQL's Sakila database:
            <customTypes>
                <customType>
                    <name>java.util.GregorianCalendar</name>
                    
<converter>com.mycompany.jooq.generator.SqlTimestampToGregorianCalendarConverter</converter>
                </customType>
            </customTypes>
            <forcedTypes>
                <forcedType>
                    <name>java.util.GregorianCalendar</name>
                    <expression>.*\.LAST_UPDATE.*</expression>
                    <types>.*</types>
                </forcedType>
            </forcedTypes>
I noticed that using wrong class names, either for types or converter, 
doesn't make the code generator complain, maven build ends successfully.

Gérald


Le vendredi 21 mars 2014 19:03:51 UTC+1, Lukas Eder a écrit :
>
> Hi Gérald,
>
> The forced types apply in order, so you can try to rewrite generally by 
> type (DATE, TIMESTAMP) and then, more specifically by column name. I'm not 
> quite sure if I understand how your description would differ from what is 
> already available today...?
>
> Regards,
> Lukas
>
>
> 2014-03-21 15:05 GMT+01:00 Gérald Quintana <[email protected]<javascript:>
> >:
>
>> JavaGenerator.getJavaType method looks like a good candidate, except the 
>> method can't access column qualified name
>>
>> Gérald
>>
>> Le vendredi 21 mars 2014 14:43:57 UTC+1, Gérald Quintana a écrit :
>>
>>> Hello,
>>>
>>> I don't want to use java.sql.Date ou java.sql.Timestamp in my code, I'd 
>>> prefer use java.util.Date or even better JodaTime/JSR310. I am aware of the 
>>> existence of converters and forced types, but there is no evident naming 
>>> scheme I could use to select which Java type to use. Using a regex on 
>>> column name is to cumbersome for me, so I thought about configuring with 
>>> Java code, I could using rules column name and column type to select Java 
>>> type, or in the worst case read a config file telling wich Java type to use 
>>> for a specific column, or something like this. Is there extension point I 
>>> could use to do this (using Maven plugin)? Obviously, the GeneratorStrategy 
>>> is only about naming not typing, isn't it?
>>>
>>> Gerald
>>>
>>  -- 
>> 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.

Reply via email to