Paste a CREATE TABLE statement to get one public class per table: private fields mapped from the SQL types, a getter and a setter for every column and the java.math and java.time imports the mapped types require. Table constraints, comments and quoted identifiers are handled and nothing is uploaded.
Runs locally in your browserPaste one or more CREATE TABLE statements and press SQL to Java Class. Every table becomes its own public class with a private field per column, a getter and a setter for each field, and the java.math and java.time imports the mapped types need.
The parser reads a documented slice of DDL rather than a full SQL grammar: MySQL, PostgreSQL, SQL Server, Oracle and SQLite column types, backticked, quoted or bracketed identifiers, column comments and table constraints. It runs in this tab, so a schema you are not allowed to upload can still be converted here.
Integer widths stay honest: int, integer, smallint, mediumint and serial become int, bigint becomes long, tinyint(1) becomes boolean while other tinyint widths become int, an unsigned int becomes long and an unsigned bigint becomes BigInteger. float, real and double become double.
decimal and numeric are read by precision and scale: scale 0 with up to 9 digits becomes int, up to 18 digits long, and anything else BigDecimal — so decimal(10,2) is BigDecimal rather than a double that would round money. char, varchar, text, json, xml, enum, set and uuid become String; date, time, datetime and timestamp become LocalDate, LocalTime, LocalDateTime or, with a time zone, OffsetDateTime; bit(1) becomes boolean and bit(n), binary, varbinary and the blob family become byte[]. A type the generator does not recognise becomes Object with a // unmapped SQL type note, never a silent guess.
Table constraints are dropped instead of being turned into fields: PRIMARY KEY (id), KEY, UNIQUE, CONSTRAINT ... FOREIGN KEY, CHECK and INDEX lines are recognised and skipped, while a column that carries its own constraint — id int PRIMARY KEY — is kept as a field. Comments written as --, # or /* */ are removed before parsing, including a comment that would otherwise swallow the rest of the line, and comment markers inside a string literal are left alone. A column-level COMMENT 'buyer id' is copied to the field as a trailing // buyer id note.
Identifiers lose their quoting: `address_id`, "user name" and [order] come out as addressId, userName and order. snake_case becomes camelCase, a name Java reserves gets a leading underscore (class becomes _class) and so does a name that starts with a digit (2fa becomes _2fa); the accessor drops that underscore, so the setter is setClass. When the Java name differs from the SQL name, the field also carries a // column: ... note, which keeps a rename visible during review.
The conversion happens in the page: while the tool works it makes no request, and the schema is not sent anywhere. Results up to 120,000 characters are syntax highlighted; a larger class is printed as plain text so the tab stays responsive. Measured in Chrome on this page, 500 columns (94 KB of Java) take about half a second with highlighting, 1,000 columns (188 KB) about 30 ms and 2,000 columns (385 KB) about 40 ms without it.
The output is a starting point, not an ORM mapping: no JPA or Hibernate annotations, no Lombok, no constructors, equals, hashCode or toString, no foreign-key relationships and no nullability — a NOT NULL column is not marked in the class. Check names and types against the schema before the class goes into a project; for a JSON sample, use the JSON to Java Class page instead.