Skip to content

Commit

Permalink
Java/jOOQ: A few more documentation edits
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Feb 6, 2023
1 parent c651a26 commit 748bbb5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
20 changes: 8 additions & 12 deletions by-language/java-jooq/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ Java jOOQ demo application with CrateDB using PostgreSQL JDBC
About
*****

In a nutshell
=============

A demo application using `CrateDB`_ with `jOOQ`_ and the `PostgreSQL JDBC
driver`_. It uses the `Gradle Build Tool`_ and the `Gradle plugin for jOOQ code
generation`_.
Expand All @@ -20,10 +17,12 @@ It is intended as a basic example to demonstrate what currently works, and as a
testing rig for eventually growing a full-fledged CrateDB extension.
Contributions are welcome.

Introduction
============

The idea of jOOQ is to generate typesafe code based on the SQL schema.
********
Synopsis
********

The idea of jOOQ is to generate typesafe code based on an SQL schema.
Then, accessing a database table using the jOOQ DSL API looks like this:

.. code-block:: java
Expand Down Expand Up @@ -85,16 +84,13 @@ Contributions to resolve any of those items will be welcome, see also
DDL) is only supported for schema definitions which use field types
compatible with standard PostgreSQL, and understood by jOOQ. jOOQ does not
know anything about any other special data types supported by CrateDB, and
does not support it. When using special field types, like ``IP``, it will
trip the code generator.
does not support it. When using special field types, like ``OBJECT``,
``ARRAY``, or ``IP``, it will trip the code generator.

- Most of the jOOQ examples use uppercase letters for the database, table, and
field names. Within this setup, we have only been able to make it work using
lowercase letters.

- We have not been able to make multiple SQL DDL statements work within a
single SQL bootstrap file at ``src/main/resources/bootstrap.sql``.


*****
Usage
Expand All @@ -119,7 +115,7 @@ Usage
./gradlew generateJooq


.. _backlog: backlog
.. _backlog: backlog.rst
.. _Bytebase: https://github.com/bytebase/bytebase
.. _CrateDB: https://github.com/crate/crate
.. _database schema migration: https://en.wikipedia.org/wiki/Schema_migration
Expand Down
26 changes: 22 additions & 4 deletions by-language/java-jooq/backlog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,31 @@ Features
``ARRAY`` are the most interesting ones.


Q & A
=====

- Question: Out of curiosity, validate if, under the hood, the actual
abstraction layer is indeed ``org.hibernate.dialect.PostgreSQL94Dialect``?
Answer: Yes, as of jOOQ 3.17.7, this is correct, see
`org.jooq.SQLDialect#L1367-L1368`_.

- Question: How to set the default schema name? The ``unqualifiedSchema``
property in ``jooq.gradle`` apparently only accepts ``public`` or ``none``.
Answer: Please check the other ``jooq.gradle`` in branch
``amo/jooq/codegen``, see `jooq.gradle#L70-L73`_::

database {
name = 'org.jooq.meta.postgres.PostgresDatabase'
inputSchema = 'testdrive'
}


Other topics
============

- When jOOQ connects to CrateDB, it displays ``SET SESSION STATEMENT WILL BE
IGNORED: extra_float_digits`` on the server console.

- Out of curiosity, validate if, under the hood, the actual abstraction layer
is indeed ``org.hibernate.dialect.PostgreSQL94Dialect``.

- Demonstrate usage together with `HikariCP`_, a high-performance JDBC
connection pool.

Expand Down Expand Up @@ -59,8 +75,10 @@ possible.
.. _IllegalStateException on nested JOINs: https://github.com/crate/crate/issues/13503
.. _importing: https://www.jooq.org/doc/latest/manual/sql-execution/importing/
.. _jOOQ for PROs: https://www.jooq.org/doc/latest/manual/getting-started/use-cases/jooq-for-pros/
.. _jooq.gradle#L70-L73: https://github.com/crate/cratedb-examples/blob/f88eda5/by-language/java-jooq/jooq.gradle#L70-L73
.. _List of RDBMS supported by jOOQ: https://www.jooq.org/doc/latest/manual/reference/supported-rdbms/
.. _README: README
.. _org.jooq.SQLDialect#L1367-L1368: https://github.com/jOOQ/jOOQ/blob/version-3.17.7/jOOQ/src/main/java/org/jooq/SQLDialect.java#L1367-L1368
.. _README: README.rst
.. _Support for "WITH RECURSIVE" CTEs: https://github.com/crate/crate/issues/12544
.. _The static query DSL API: https://www.jooq.org/doc/latest/manual/sql-building/dsl/
.. _Using JDBC batch operations: https://www.jooq.org/doc/latest/manual/sql-execution/batch-execution/

0 comments on commit 748bbb5

Please sign in to comment.