It combines active records, stored procedures, advanced data types, complex SQL, typesafety, source code generation and Java in a fluent, intuitive DSL.
jOOQ generates a simple Java representation of the database schema.
For every table, view, stored procedure, enum, UDT is a class.
jOOQ implements an easy-to-use active record pattern. It is NOT an OR-mapper, but provides a 1:1 mapping between tables/views and classes. Between columns and members.
It also allows for writing compile-time typesafe querying using its built-in DSL.
jOOQ supports all standard SQL language features including the more complex UNION's, nested SELECTs, JOINs, aliasing
jOOQ allows developers the use of vendor-specific extensions such as stored procedures, UDT's, ARRAY's and many more.
- General features:
- Object Oriented SQL Modelling
- SQL code generation
- Typesafe SQL
- Stored procedure and UDT support
- Supported databases:
- MySQL 5.1.41 and 5.5.8
- H2 1.3.154
- Oracle XE 10.2.0.1.0
- DB2 9.7
- PostgreSQL 9.0
- HSQLDB 2.0.0
- SQLite with inofficial JDBC driver v056
- Derby 10.7
- Future support for:
What is new in this release:
- Factory has been split into DSL (static QueryPart construction) and DSLContext (Query execution, "attached" QueryPart construction). This greatly improves the overall DSL experience while allowing for more fine-grained Executor lifecycle control.
- A ConnectionProvider has been introduced as an abstraction of the JDBC Connection lifecycle. The standalone Connection and pooled DataSource modes are still supported, but you can now inject your own ConnectionProvider for more control.
- A lot of performance improvements have been implemented within the jOOQ API removing most of the overhead caused by jOOQ when fetching data from JDBC
- A JDBC Mock API has been added to help you create simple unit tests for your application built on top of jOOQ.
- A VALUES() constructor is now supported, and derived column lists to alias tables and columns in one go.
- The data type API has been greatly simplified. This allowed for the introduction of runtime precision, scale, and length information.
- CRUD has been improved through many more CRUD batch operations, explicit INSERT and UPDATE (in addition to store()), and explicit handling of jOOQ's internal changed flags.
What is new in version 2.6.1:
- Bad Postgres array serialisation when " or \ characters are contained in a String
- Inefficient implementations of AbstractDataType.equals() and hashCode()
- Improve AbstractField.hashCode() and AbstractTable.hashCode() and similar, as these two are called very often
- Inefficient call to String.split() in StringUtils.toCamelCase() leads to non-negligible performance ovrerhead in POJO transformation calls
- Bad SQL rendered when combining ORDER BY [ some-function ] with LIMIT .. OFFSET in DB2, SQL Server
- Bad SQL rendered for OVER (ORDER BY [ some-function ]) for SQL Server and Sybase
- Thread safety issue in org.jooq.impl.FieldList
- Bad reference to org.jooq.debug.[impl].DebugListener in the manual
- Bad code generated when the same table name exists in multiple schemas in SQL Server
What is new in version 2.5.0:
- Remove casting of bind values in Ingres
- Simulate RPAD and LPAD in SQLite
- Add support for Oracle Text functions
- Add option to generate immutable pojos
- Support "optimistic locking" in UpdatableRecord.store() and delete()
- Generate fetchBy[ColumnName] methods in generated DAO classes
- Add some Javadoc to document the difference between using a Factory with a Connection or with a DataSource
- Add javax.validation API to full deliverable
- Add Factory.connectByRoot(Field<?>) to support the Oracle CONNECT_BY_ROOT pseudo column
- Add Factory.condition(String, QueryPart...) similar to Factory.field(String, QueryPart...)
- Add support for Oracle's ORDER SIBLINGS BY clause, in combination with CONNECT BY
- Add missing constructors taking DataSource to dialect-specific factories
- Generate missing constructors taking DataSource in schema-specific factories
- Simulate REPEAT() in SQLite
What is new in version 2.4.0:
- Added Result.intoResultSet() to wrap a Result in a JDBC ResultSet
- Avoid JDBC escape syntax for date/time literals
- Generate DAO classes and interfaces for POJOs
- Document the lifecycle of an ExecuteListener in the Javadoc
- Added support for Postgres "any" data type (with quotes!). This seems to map well to java.lang.Object
- Support case-insensitive schema names in code generation
- Added some WARN-level logging when the source-code generator doesn't generate any artefacts
- Added Field.likeIgnoreCase() to support Postgres' ILIKE operator
- Added Factory(DataSource) and similar constructors
- Added Factory.batchStore(Collection<? extends UpdatableRecord<?>>) for convenience
- Added DataType.convert(Object...) and DataType.convert(Collection<?>) for convenience
- Added org.jooq.Name Factory.name(String) to contruct QueryParts that are escaped according to Settings.getRenderNameStyle()
- Added Factory.fetch(String, QueryPart...) and Factory.execute(String, QueryPart...) and similar methods to support arbitrary QueryParts in plain SQL
What is new in version 2.3.2:
- Performance issue with AbstractDataType.convert(Object). Avoid conversions when they're obviously unneeded.
- Generate some meaningful Javadoc into the generated [schema-name]Factory classes.
- Added line breaks to generated Javadoc where appropriate
- Custom generator strategy's printImplements() is called with Mode == RECORD for tables.
- Inefficient cloning of default settings using JAXB unmarshalling leads to non-negligible overall overhead. Use serialisation instead (short of a useful XJC clone plugin).
- Caching SQLDialect in AbstractDatabase heavily improves code generation performance.
- Compilation error when a SQL Server stored procedure has a parameter named "value".
- Bad syntax for SELECT /*+hint*/ DISTINCT ... in Oracle.
- Splitting of large NOT IN conditions is wrong. The parts should be connected with AND, not with OR.
What is new in version 2.2.0:
- Added support for the CUBRID database.
What is new in version 2.1.0:
- The possibility of providing jOOQ with a custom type mapping.
- There are a lot of new runtime configuration options to control the SQL style of SQL rendered by jOOQ.
- The handling of NULL has been improved in favour of using jOOQ as a SQL builder library (e.g. along with Spring for execution) NULL is no longer inlined, but bound as a variable.
- jOOQ now supports simulation of the relational division operation using an intuitive syntax.
What is new in version 2.0.5:
- Execute listener and SQL tracing support. jOOQ allows you to hook your own listeners into jOOQ's query execution engine to be notified of all sorts of events
- The existing SchemaMapping features. They are now part of the runtime configuration
- StatementType settings. Specify whether a Factory should execute java.sql.PreparedStatements (with bind variables) or static java.sql.Statements with inlined variables.
What is new in version 2.0.0:
- The API became more static.
- By default, jooq-codegen will now generate a "dynamic" meta model as opposed to the existing static one.
- Exceptions are no longer checked.
- Window functions are now constructed from their underlying aggregate functions just like in SQL.
- Java 1.6 or higher