java - Character Set Problem In Jooq Model Generation
问题描述
I'm using PostgreSql and Jooq for my backend java project. Postgre Character Set UTF-8 Collation WIN1254 Turkish. Sample Table
BRAND -- TABLE
- Id
- Name
MODEL -- TABLE
- Id
- Name
- BrandId
'I' character is big 'i'. It is not 'ı' from Turkish letter.
Jooq generates model as 'BRANDİD' and 'getBrandıd'. 'getBrandıd' is not allowed to use in html. Spring gives error for this usage. I was tried changed character set for jooq model generation, but it did not work. Unsupported characters would be insterted in java model code as '?'. How can I resolve this problem?
解决方案
A similar question was asked recently on the jOOQ user group:
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:
- https://www.jooq.org/doc/latest/manual/code-generation/codegen-generatorstrategy/
- https://www.jooq.org/doc/latest/manual/code-generation/codegen-matcherstrategy/
There currently isn't any way to specify the code generation locale, though there should be. There's a pending feature request for this https://github.com/jOOQ/jOOQ/issues/9744
推荐阅读
- python - Django REST 框架 UniqueTogetherValidator
- asp.net-mvc - 是否可以引用另一个表以使员工记录与用户记录相关联?
- javascript - 如何使用 Beautiful Soup 访问此项目
- java - 从 2 个集合中找到共同元素的最佳方法是什么?
- jquery - chrome 更新到版本 75.0.3770.80(官方构建)(64 位)后重复请求并将数据两次保存到数据库问题
- c# - PostgresException: 42883: 函数 X(timestamp without time zone) 在尝试调用过程时不存在
- tcp - 奇怪的IP包分析?
- java - 只发布单向多对一关系的 id
- c# - 如何在 .NET 中反序列化 { "result" : [ true, [1,2] ] }
- uml - 如何在 UML 中显示方法和变量的注释