Hi guys,

I'm working on Oracle 11g XE with jOOQ 3.10.6 (trial version) and I'm 
trying to use the jOOQ's Data Type Rewrite feature 
<https://www.jooq.org/doc/3.10/manual/code-generation/codegen-advanced/codegen-config-database/codegen-database-forced-types/>
 
but It's not working as I'd like to.

When I generate my classes via jOOQ generator it is considering all columns 
with type NUMBER (without explict precision and scale) as BigDecimal in 
Java code. Unfortunately all my tables have PK columns as NUMBER (again, no 
precision and no scale) and I can't change it! But what I really want is 
those attributes be of type java.lang.Integer (don't worry, I understand 
the risks related to precision here).

To solve that, I configured jOOQ generator config file to *rewrite all 
columns which their names start with "ID_" and are of type NUMBER* (without 
explict precision and scale), as you can see below:

<forcedTypes>
 <forcedType>
 <name>INTEGER</name>
 <expression>.*\.ID_.*</expression>
 <types>NUMBER</types>
 </forcedType>
</forcedTypes>


But it's generating all class attributes as BigInteger instead of Integer 
<https://www.jooq.org/javadoc/3.9.0/org/jooq/impl/SQLDataType.html#INTEGER>. 
For some reason I think it's related to this default jOOQ behavior 
<https://stackoverflow.com/questions/39921053/jooq-oracle-number-precision-and-java-number-mapping>.
 
The best I've got was generating those attributes as java.lang.Long through 
this configuration:

<forcedTypes>
 <forcedType>
 <name>BIGINT</name>
 <expression>.*\.ID_.*</expression>
 <types>NUMBER</types>
 </forcedType>
</forcedTypes>


I can't understand why it works for BIGINT but not for INTEGER.

Someone could give me any tip?

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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to