Parse CREATE TABLE into a Java POJO with Lombok / JPA annotations.

Switch tool
CREATE TABLE input
Generated entity0 tables

How to use

Purpose

Convert SQL CREATE TABLE DDL into Java POJOs with JPA / MyBatis-Plus / Lombok annotations. Smart type mapping (VARCHAR → String, INT → Integer, TIMESTAMP → LocalDateTime, DECIMAL → BigDecimal), generates field comments from SQL COMMENT, @Column annotations, @Id, @GeneratedValue. Also supports snake_case → camelCase, optional explicit getter/setter (when Lombok is forbidden), Builder pattern. All conversion runs locally.

Steps

  1. Paste CREATE TABLE on the left (COMMENT improves output)
  2. Pick ORM: JPA (Hibernate), MyBatis-Plus, plain POJO
  3. Pick annotation style: Lombok (@Data) or explicit getter/setter
  4. Right pane shows the Java class in real time
  5. Field names: auto snake_case → camelCase
  6. Type mapping: INT → Integer or int, DATETIME → LocalDateTime
  7. Primary key: @Id @GeneratedValue auto-added
  8. Class comment: extracted from table COMMENT as Javadoc

FAQ

JPA vs MyBatis-Plus annotations?
JPA: @Entity @Table @Column @Id @GeneratedValue (javax.persistence / jakarta.persistence). MyBatis-Plus: @TableName @TableField @TableId (com.baomidou.mybatisplus.annotation). Cannot mix. Spring Data JPA: pick JPA. Legacy MyBatis with MP enhancement: pick MyBatis-Plus.
Type mapping gotchas?
TIMESTAMP/DATETIME: use LocalDateTime (Java 8+), not Date. DATE: LocalDate. TIME: LocalTime. DECIMAL/NUMERIC: BigDecimal (never double — precision loss). TINYINT(1): Boolean or Integer depending on business (0/1 = Boolean, 0-9 = status code = Integer). TEXT/LONGTEXT: String with @Column(columnDefinition = "TEXT").
How to pick a primary key strategy?
JPA @GeneratedValue: IDENTITY (MySQL AUTO_INCREMENT), SEQUENCE (Oracle/PostgreSQL), AUTO (let ORM choose — not recommended), TABLE (dedicated sequence table). MyBatis-Plus @TableId: AUTO (DB auto-increment), ASSIGN_ID (snowflake), ASSIGN_UUID (UUID).
How are composite primary keys generated?
JPA uses @IdClass or @EmbeddedId for composite keys. @IdClass: separate ID class, entity marks multiple @Id fields. @EmbeddedId: encapsulate keys in an embedded class. When the tool sees PRIMARY KEY (col1, col2), it defaults to @IdClass and generates two classes.
How are table/field prefixes (e.g. t_user) handled?
A "strip prefix" option: t_user becomes class User (drops t_), f_name becomes property name (drops f_). In real projects, prefixes are DB conventions to avoid cross-module collisions; Java classes do not need them.

Use cases

  • Legacy DDL import: DBA hands you DDL → Java entity in one click
  • Database design to code: from design (DDL) generate entities
  • PowerDesigner / DB schema tools export SQL, batch convert
  • Microservice split: split big table into smaller tables, generate new entities
  • Database migration: legacy DB DDL → entity, validate field consistency

Use cases

SQL DDL to entity, DB design to code, PowerDesigner/Navicat export handling, microservice split, DB migration. Java backend, DBA, architect. JPA/MP dual ORM, Lombok option, smart type mapping, composite keys are the differentiators.