简体   繁体   English

Jooq生成POJO缺少评论

[英]Jooq generates POJO missing comments

eg. 例如。

SQL: SQL:

 CREATE TABLE `collect` (
  `travel_id` int NOT NULL COMMENT 'travel id',
  `description` varchar(64)  COMMENT 'description',
  `creat_time` timestamp DEFAULT CURRENT_TIMESTAMP COMMENT 'creat time',
  PRIMARY KEY (`travel_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='collect';

The resulting POJO is as follows. 生成的POJO如下。

/**
 * collect
 */
@Generated(
    value = {
        "http://www.jooq.org",
        "jOOQ version:3.9.2"
    },
    comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Collect implements Serializable {

    private Integer       travelId; 
    private String        description;
    private LocalDateTime creatTime;

    ...
}

The POJO I want should be like this. 我想要的POJO应该是这样的。

eg: 例如:

private Integer       travelId //trave_lId 

or 要么

/* trave_lId */
private Integer       travelId 

my code generator: 我的代码生成器:

.withPojos(true)
.withDaos(true)
.withSpringAnnotations(true)
.withJavaTimeTypes(true)

the POJO field does not have a corresponding comment. POJO字段没有相应的注释。 what should i do? 我该怎么办?

Currently (as of jOOQ 3.9 and 3.10), comments are only generated on tables and records, not on POJOs. 当前(从jOOQ 3.9和3.10开始),注释仅在表和记录上生成,而不在POJO上生成。 That's a missing feature which should be implemented in a future jOOQ version. 这是缺少的功能,应该在将来的jOOQ版本中实现。 I've created a feature request for this: https://github.com/jOOQ/jOOQ/issues/6456 我为此创建了一个功能请求: https : //github.com/jOOQ/jOOQ/issues/6456

You can override the JavaGenerator class from jooq-codegen in order to generate those comments manually, eg by overriding JavaGenerator.generatePojo() . 您可以重写jooq- JavaGenerator类,以便手动生成这些注释,例如,通过重写JavaGenerator.generatePojo()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM