What is SQL to jOOQ Generator?
This tool converts SQL CREATE TABLE statements into jOOQ Java code. jOOQ (Java Object Oriented Querying) is a library that generates type-safe SQL queries in Java. The converter creates Table and Field constants that can be used to build compile-time checked SQL queries.
How to Use
- Paste your SQL CREATE TABLE statements into the input area
- Click "Generate" to create jOOQ Java code
- Copy the output and save it as a .java file in your jOOQ project
- Use the generated Table and Field constants in your queries
Why Use This Tool?
Tips & Best Practices
- Field names follow SCREAMING_SNAKE_CASE convention (e.g., USER_ID)
- Table names are converted to uppercase constants (e.g., USER)
- Java types are inferred from SQL column types automatically
- Generated code uses org.jooq.impl.DSL static imports
Frequently Asked Questions
What is jOOQ?
jOOQ (Java Object Oriented Querying) is a Java library that provides a fluent API for building type-safe SQL queries. It generates Java code from your database schema, allowing you to write SQL in Java with compile-time checking.
How are SQL types mapped to Java types?
VARCHAR/TEXT → String, INTEGER/BIGINT → Long, SMALLINT → Short, FLOAT/DOUBLE → Double, BOOLEAN → Boolean, DATE → LocalDate, TIME → LocalTime, TIMESTAMP → LocalDateTime, UUID → UUID, BLOB → byte[]
What is the naming convention?
Table and field names are converted to SCREAMING_SNAKE_CASE. For example, a table "user_profiles" becomes USER_PROFILES, and a column "created_at" becomes USER_PROFILES_CREATED_AT.
How do I use the generated code?
Import the Tables class and use the constants in jOOQ queries. Example: dsl.selectFrom(Tables.USER).where(Tables.USER_ID.eq(1L)).fetch()
Is my SQL data sent to a server?
No, all processing happens entirely in your browser. Your SQL schema never leaves your device.