This release is a fresh start in many areas of jOOQ, adressing issues that have been requested by users for a long time. These release notes document the most important changes, a detailed upgrade guide, as well as the detailed list of improvements.
For full details, please visit the release notes page: http://www.jooq.org/notes.php Most important changes ---------------------- - The API became more static. This applies to many Factory methods, such as val(), literal(), as well as to many Field methods that have been moved over to the Factory. For example, when before, you wrote this using "postfix function notation": <pre>NAME.replace(" ", "_").trim()</pre> you will now write (just as in SQL): <pre>trim(replace(NAME, " ", "_"))</pre> Using static imports of Factory.*, jOOQ makes SQL look even more like SQL. The current "postfix notation" is maintained for backwards compatibility. - By default, jooq-codegen will now generate a "dynamic" meta model as opposed to the existing static one. Generated tables covariantly override the as(String) aliasing method, leading to a much more convenient aliasing style. When before, you wrote: Table<TRecord> parent = T.as("parent"); Table<TRecord> child = T.as("child"); Condition join = parent.getField("ID").equal(child.getField("PARENT_ID")) You can now write: T parent = T.as("parent"); T child = T.as("child"); Condition join = parent.ID.equal(child.PARENT_ID) Of course, the existing notation still works - Exceptions are no longer checked. When previously, the DB's SQLException was propagated to client code, there is now an unchecked DataAccessException hierarchy, similar to that of Spring. This will eventually give way to a standardised error handling abstraction, in future developments . - Window functions are now constructed from their underlying aggregate functions just like in SQL. For example: sum(AMOUNT) sum(AMOUNT).over().partitionBy(ACCOUNT) This makes for a more concise API, especially when considering future extensions, such as Oracle's KEEP (DENSE_RANK FIRST...) syntax. - More type safety has been introduced regarding various places where generic <R extends Record> and <T> types are involved. This is especially true for INSERT / UPDATE / DELETE statements - Sequences now also have a <T> type - Unsigned number types are now supported in those databases that use them. Unsigned numbers are implemented in jOOU, a spin-off open source project. For convenience, this library is "internalised" into jOOQ, to avoid adding a dependency http://code.google.com/p/joou/ Upgrade instructions: --------------------- Various of the above changes are incompatible with jOOQ 1.x. In order to upgrade, please be aware of the following pitfalls: - The schema needs to be re-generated. - Much of the post-fix function notation is replaced by static methods in the Factory. Today's org.jooq.Field API is maintained in jOOQ 2.0, for backwards compatibility. It will be removed, eventually, though. Expect some incompatible changes, where window functions are involved - Some Factory instance methods (such as val(), literal()) are now static. They are compatible, but may cause compiler warnings. - The meta model is now an instance model by default. If you prefer the static meta model, you can configure this in your jooq-codegen configuration. - The additional typesafety involving <R> and <T> types may cause compiler warnings and errors. - SQLException is no longer part of the API. This can cause compiler issues, in particular when extending jOOQ - Some utility classes have moved to org.jooq.tools Should these incompatibilities be too significant for your project, you can still stay on the 1.x branch, which will be maintained for a while. Be aware that upgrading might be more difficult, later, though.
