JOOQ generates classes with localized language so I have "İD" variables all over the place in generated classes

61 views
Skip to first unread message

nihater...@gmail.com

unread,
Jan 17, 2020, 8:42:40 AM1/17/20
to jOOQ User Group
/**
* The column <code>hx_cms.cms_document.id</code>.
*/
public final TableField<CmsDocumentRecord, Integer> İD = createField("id", org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaultValue(org.jooq.impl.DSL.field("nextval('cms_document_id_seq'::regclass)", org.jooq.impl.SQLDataType.INTEGER)), this, "");

/**
* The column <code>hx_cms.cms_document.name</code>.
*/
public final TableField<CmsDocumentRecord, String> NAME = createField("name", org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false), this, "");

/**
* The column <code>hx_cms.cms_document.org_id</code>.
*/
public final TableField<CmsDocumentRecord, Integer> ORG_İD = createField("org_id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");

/**
* The column <code>hx_cms.cms_document.category_id</code>.
*/
public final TableField<CmsDocumentRecord, Integer> CATEGORY_İD = createField("category_id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");



In Turkish language the corresponding UPPER CASE letter to the lower case " i " is the character " İ " as we also have a separate " ı - I " in our alphabet. This creates the problem you see above in the generated classes. I do not know how and when to fix this issue.

Here is how JOOQ generates the classes in to the project:

<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>

<executions>
<execution>
<id>generate-postgresql</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<jdbc>
<driver>${spring.datasource.driverClassName}</driver>
<url>${spring.datasource.url}</url>
<user>${spring.datasource.username}</user>
<password>${spring.datasource.password}</password>
</jdbc>
<generator>
<database>
<name>org.jooq.meta.postgres.PostgresDatabase</name>
<includes>.*</includes>
<excludes></excludes>
<dateAsTimestamp>true</dateAsTimestamp>
<inputSchema>hx_cms</inputSchema>
</database>
<generate>
<deprecated>false</deprecated>
<instanceFields>true</instanceFields>
<pojos>true</pojos>
</generate>
<target>
<packageName>com.hx.db.postgresql</packageName>
<directory>target/generated-sources/jooq-postgresql</directory>
</target>
</generator>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
</dependencies>
</plugin> 

I am assuming some kind of configuration goes in here but I cannot find the answer.

Thank you.

Lukas Eder

unread,
Jan 17, 2020, 8:47:55 AM1/17/20
to jOOQ User Group
Thanks for your message.

The easiest way to fix this is to override the default Locale of your JVM that runs the code generation. E.g. using:
set MAVEN_OPTS= -Duser.language=en

This may be flaky of course, as some environments may not be configured correctly.

Another way to fix it is to write your own generator strategy:

We currently do not have any way to specify the code generation locale, though we should. I've created a feature request for this:

Thanks,
Lukas 

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/4371f417-76e5-4a75-83a3-fc520c1d326e%40googlegroups.com.

eren....@hepsijet.com

unread,
Jan 17, 2020, 9:00:32 AM1/17/20
to jOOQ User Group
Thank you very much for the fast reply and glad to see that you consider providing a more appropriate solution to the problem. 

Good luck.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq...@googlegroups.com.

Lukas Eder

unread,
Aug 21, 2020, 8:29:13 AM8/21/20
to jOOQ User Group
Issue  https://github.com/jOOQ/jOOQ/issues/9744  has now been resolved for jOOQ 3.14. Just add your <target><locale>tr</locale> </target> to your code generator config.

Thanks,
Lukas

Reply all
Reply to author
Forward
0 new messages