简体   繁体   中英

Jooq generates POJO missing comments

eg.

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.

/**
 * 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.

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. what should i do?

Currently (as of jOOQ 3.9 and 3.10), comments are only generated on tables and records, not on POJOs. That's a missing feature which should be implemented in a future jOOQ version. I've created a feature request for this: 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() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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