Initialising Workbench...
Paste a CREATE TABLE statement and instantly generate JPA entity classes for MySQL, PostgreSQL, SQLite, SQL Server, or Oracle.
CREATE TABLE Input
Java Output
Dialect: MySQL
Generated from local input only. No data is uploaded.
Every tool runs entirely in your browser. Nothing you type is uploaded, stored, or logged on our servers.
The SQL to Java Entity Generator turns one or more CREATE TABLE statements into ready-to-use JPA entity classes. Paste DDL exported from MySQL, PostgreSQL, SQLite, SQL Server, or Oracle and it maps every column to its closest Java type — VARCHAR to String, DECIMAL(10,2) to BigDecimal with precision/scale, ENUM to a Java enum, and so on.
Primary keys get @Id (and @GeneratedValue when the column auto-increments), and single-column FOREIGN KEY constraints become @ManyToOne object references instead of raw id fields. Toggle Lombok for @Data classes, or Bean Validation for @NotNull/@Size alongside the JPA annotations.
This CREATE TABLE to Java converter is useful for quickly scaffolding entity classes from an existing database schema or a migration file, without typing each class by hand. It runs entirely in your browser — no SQL is uploaded.
MySQL, PostgreSQL, SQLite, SQL Server, and Oracle. Each dialect has its own type mapping — for example SERIAL/BIGSERIAL (PostgreSQL), AUTO_INCREMENT (MySQL), IDENTITY (SQL Server), AUTOINCREMENT (SQLite), and NUMBER precision rules (Oracle) are all handled separately.
Yes. Paste as many CREATE TABLE statements as you like — each becomes its own Java entity class, and the tool detects FOREIGN KEY relationships between them automatically.
When "Generate @ManyToOne relationships" is enabled, a single-column foreign key like user_id becomes a @ManyToOne object reference (private User user;) annotated with @JoinColumn, instead of a raw Long field. Disable the toggle to keep foreign key columns as plain scalar fields.
MySQL ENUM columns become a Java enum annotated with @Enumerated(EnumType.STRING). If a DB enum value can't be turned into a valid, matching Java constant name, the generated code adds a comment flagging that an AttributeConverter may be needed.
Multi-column PRIMARY KEY constraints are detected and flagged with a comment (composite keys need @EmbeddedId or @IdClass, which depend on how you want to model the key class, so they aren't auto-generated).
No. Parsing and entity generation run entirely in your browser — no SQL content is sent to a server.