Hello,
I've looked into your case. The problem here is the fact that MySQL reports
data types in lower case, while the jOOQ code generator applies simple Java
regex matching with the <types/> configuration. The following config will
work for me:
<forcedType>
<name>BOOLEAN</name>
<expression>.*</expression>
<types>tinyint</types>
</forcedType>
<forcedType>
<name>BIGINT</name>
<expression>.*</expression>
<types>int</types>
</forcedType>
Essentially, you can find the column / type combinations as reported by
MySQL like this:
select column_name, data_type
from information_schema.columns
where table_name = 'sample'
order by ordinal_position
I think we should improve the manual and make another reference about using
case-insensitive regular expressions, just to stay on the safe side:
<forcedType>
<name>BIGINT</name>
<expression>.*</expression>
<types>(?i:int)</types>
</forcedType>
https://github.com/jOOQ/jOOQ/issues/3859
Hope this helps,
Lukas
2014-12-08 15:50 GMT+01:00 <[email protected]>:
> Here is a sample
> CREATE TABLE `sample` (
> `id` int(11) NOT NULL AUTO_INCREMENT,
> `soft_deleted` tinyint(1) NOT NULL,
> PRIMARY KEY (`id`)
> )
>
> I get that the number in parenthesis are formatting details, but these
> are existing tables. int to Long and tinyint to boolean. Thanks very much.
>
> On Monday, December 8, 2014 3:13:59 AM UTC-5, Lukas Eder wrote:
>>
>> Hi.
>>
>> I suspect you're using MySQL given that you're specifying formatting
>> lengths for fixed-size integers. Do note that there is no such thing as an
>> INT(11) type in SQL, even in MySQL. 11 only means the width of the
>> formatting, not the actual number of decimal digits. The same holds true
>> for TINYINT(1), which doesn't mean numbers with only 1 digit. It means that
>> by default, only one digit is displayed.
>>
>> If fixing the schema accordingly is not an option, I can help with the
>> configuration, if you provide me with the DDL of the tables that you'd like
>> to convert, but that don't really work...
>>
>> Best Regards,
>> Lukas
>>
>> 2014-12-08 6:11 GMT+01:00 <[email protected]>:
>>
>>> HI,
>>>
>>> I am trying to get forcedTYpes defined in my pom.xml to generate code is
>>> our preferred type (Env mysql, jooq 3.5.0)
>>>
>>> columsn marked an INT , INT(11) get generated with type Integer, but we
>>> would like them as Llong the generated java classes. Also need tinyint(1)
>>> to mapped to Boolean.
>>>
>>> I have tried some variation of below declarations, but still not getting
>>> the preferred types.
>>> <forcedTypes>
>>> <forcedType>
>>> <name>TINYINT(1)</name>
>>> <expression>.*</expression>
>>> <types>BOOLEAN</types>
>>> </forcedType>
>>> <forcedType>
>>> <name>BIGINT</name>
>>> <expression>.*</expression>
>>> <types>INT</types>
>>> </forcedType>
>>> </forcedTypes>
>>>
>>> --
>>> 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.
>>>
>>
>> --
> 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.
>
--
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.