SQL to Java Entity Generator

Paste a CREATE TABLE statement and instantly generate JPA entity classes for MySQL, PostgreSQL, SQLite, SQL Server, or Oracle.

CREATE TABLE Input

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Java Output

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144

Generation Settings

Dialect: MySQL

Generated from local input only. No data is uploaded.

Your Data Never Leaves Your Device

Every tool runs entirely in your browser. Nothing you type is uploaded, stored, or logged on our servers.

100% Client-Side

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.

FAQ

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.