Sunday, September 8, 2024
HomeProgramming3.16.0 Launch with a brand new Public Question Object Mannequin API, Spatial...

3.16.0 Launch with a brand new Public Question Object Mannequin API, Spatial Help, YugabyteDB Help and A lot Extra – Java, SQL and jOOQ.


This launch tackles two lengthy standing and sophisticated function requests that customers
have requested us to supply for a very long time: a public API for manipulating jOOQ’s
question object mannequin (QOM), and spatial help.

New Question Object Mannequin (QOM)

Each jOOQ question is modeled as an expression tree constructed through our intuitive
DSL. For some use-cases there exist historic mannequin API variations (e.g.
SelectQuery), however these fashions aren’t readable or transformable. We’re now
beginning to provide most of our expression tree mannequin as a public API for customers to
eat and manipulate. Each expression tree component has a corresponding kind
in org.jooq.impl.QOM. Each kind offers entry to its elements utilizing "$"
prefixed methodology names, e.g.:

// Create an expression utilizing the DSL API:
Subject discipline = substring(BOOK.TITLE, 2, 4);

// Entry the expression's internals utilizing the mannequin API
if (discipline instanceof QOM.Substring substring) {
    Subject string = substring.$string();
    Subject startingPosition = substring.$startingPosition();
    Subject size = substring.$size();
}

The brand new API is experimental and may change within the subsequent minor launch.

Licensed energy customers will get auxiliary APIs to traverse and rework the
expression tree, e.g. traversal:

// Incorporates 7 question elements 
lengthy count2 = BOOK.ID.eq(1).or(BOOK.ID.eq(2))
    .$traverse(Traversers.gathering(Collectors.counting());

Or alternative:

// Incorporates redundant operators
Situation c = not(not(BOOK.ID.eq(1)));
System.out.println(c.$change(q ->
    q instanceof QOM.Not n1 && n1.$arg1() instanceof QOM.Not n2
        ? n2.$arg1()
        : q
));

The above prints the next, having eliminated the redundant NOT operators:

"BOOK"."ID" = 1

This new API could be very highly effective for much more subtle dynamic SQL use-cases,
resembling:

  • Optimising SQL expressions because the above NOT NOT instance
  • Row stage safety
  • Smooth deletion
  • Shared schema multi tenancy
  • Audit column help
  • And rather more (keep tuned for future blogs and out-of-the-box transformations)

For more information, see:

Spatial help

A protracted awaited function that begins delivery to our commercially licensed
clients is spatial help. Many dialects help the ISO/IEC 13249-3:2016 SQL
commonplace extension, and eventually, so will we.

jOOQ introduces new auxiliary knowledge sorts for GEOMETRY and GEOGRAPHY knowledge to make use of
as standardised bind variables, containing WKB or WKT knowledge, in addition to a
number of out of the field features and predicates.

Future variations will add extra help for different features and dialects.

New dialect and variations

One other new formally supported SQL dialect has been added to all jOOQ editions
together with the jOOQ Open Supply Version: YugabyteDB. This was a sponsored
integration, thanks very a lot Yugabyte!

Different dialects have upgraded variations, that means:

  • We help this model in all editions now
  • The jOOQ Open Supply Version now requires this model if relevant

The variations are:

  • Firebird 4.0
  • H2 2.0.202
  • MariaDB 10.6
  • PostgreSQL 14
  • Oracle 21c

Computed and readonly columns together with ROWID

Plenty of dialects help computed columns (“generated” columns), and we now
help these as effectively in jOOQ. For many use-cases, this doesn’t have an effect on jOOQ
utilization, however particularly when writing CRUD code, the brand new readonly column function
might be very useful to keep away from having to exclude computed columns manually from
the CRUD operation.

This additionally features a new, improved ROWID help, the place customers can select to work
with an artificial ROWID column as an alternative of the first key, when performing CRUD
operations.

All of those options can be found within the industrial jOOQ editions.

Jakarta EE

We’ve moved on from Java EE to Jakarta EE dependencies. This alteration is
at the moment backwards incompatible as a result of:

  • It vastly facilitates sustaining the associated code
  • It prevents tons of person issues ensuing from having each dependencies
  • We’re not really integrating tightly with Java EE / Jakarta EE

The next Jakarta EE modules are affected:

  • JAXB, which we’re utilizing to load our configuration objects.
  • Validation, whose annotations might be generated by the code generator.
  • JPA, which is utilized by the DefaultRecordMapper and the JPADatabase

If this breaking change causes points, please get in contact at
https://github.com/jOOQ/jOOQ/points/9641

Varied enhancements

As with each minor launch, a number of smaller enhancements have been
carried out. Some highlights embrace:

  • PostgreSQL procedures at the moment are supported in code technology and at runtime.
  • SQLite JSON help has been added, which incorporates the MULTISET emulation!
  • Plenty of MULTISET / ROW enhancements have been carried out
  • R2DBC 0.9 has been launched, and we’ve upgraded our dependency
  • The Java 17 distribution now requires Java 17 as an alternative of Java 16
  • Pre jOOQ 3.6 deprecations have been eliminated

Full launch notes right here

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments