4
4
Java jOOQ demo application for CrateDB using PostgreSQL JDBC
5
5
############################################################
6
6
7
+
7
8
*****
8
9
About
9
10
*****
@@ -12,9 +13,8 @@ A demo application using `CrateDB`_ with `jOOQ`_ and the `PostgreSQL
12
13
JDBC driver `_.
13
14
14
15
It is intended as a basic example to demonstrate what currently works, and as a
15
- testing rig for eventually growing a full-fledged CrateDB dialect, or at least
16
- making the code generator work. Contributions are welcome.
17
-
16
+ testing rig for eventually growing a full-fledged CrateDB dialect.
17
+ Contributions are welcome.
18
18
19
19
Introduction
20
20
============
@@ -35,19 +35,48 @@ In some kind, jOOQ is similar to `LINQ`_, `but better <Insight into Language
35
35
Integrated Querying_> `_.
36
36
37
37
38
+ *******
38
39
Details
39
- =======
40
+ *******
41
+
42
+ Overview
43
+ ========
40
44
41
- The code example will demonstrate a few of the `different use cases for jOOQ `_.
42
- That is, `Dynamic SQL `_, the `jOOQ DSL API `_, and how to use `jOOQ as a SQL
43
- builder without code generation `_.
45
+ The code examples will demonstrate a few of the `different use cases for jOOQ `_.
46
+ That is, how to use the `jOOQ DSL API `_ based on code generated with `jOOQ's
47
+ code generator `_ to take your database schema and reverse-engineer it into a
48
+ set of Java classes, as well how to use the `Dynamic SQL API `_ by using `jOOQ
49
+ as a SQL builder without code generation `_.
44
50
51
+ Schema management
52
+ =================
53
+
54
+ In many cases, the schema is defined in the form of SQL scripts, which can be
55
+ used with a `database schema migration `_ framework like `Flyway `_,
56
+ `Liquibase `_, `Bytebase `_, etc.
57
+
58
+ The `DDLDatabase - Code generation from SQL files `_ feature can be used to
59
+ effectively reflect the database schema from SQL DDL files, without needing
60
+ a database instance at all. The code provided within the ``src/generated ``
61
+ directory has been generated like this.
45
62
46
63
Caveats
47
64
=======
48
65
66
+ - `jOOQ's code generator `_ currently does not work with directly connecting to
67
+ a real CrateDB database instance and reflecting the schema from there.
68
+ Because SQL DDL statements are usually maintained in form of multiple
69
+ incremental migration scripts anyway, this is considered to be not of a too
70
+ big concern, see above. With corresponding improvements to CrateDB, this
71
+ can be made work in the future, see `issue #10 - with reflection from the
72
+ database `_.
73
+
49
74
- Most of the jOOQ examples use uppercase letters for the database, table, and
50
- field names. CrateDB currently only handles lowercase letters.
75
+ field names. Within this setup, we have only been able to make it work using
76
+ lowercase letters.
77
+
78
+ - We have not been able to make multiple SQL DDL statements work within a
79
+ single SQL bootstrap file at ``src/main/resources/bootstrap.sql ``.
51
80
52
81
53
82
*****
@@ -73,15 +102,21 @@ Usage
73
102
./gradlew generateJooq
74
103
75
104
105
+ .. _Bytebase : https://github.com/bytebase/bytebase
76
106
.. _CrateDB : https://github.com/crate/crate
107
+ .. _database schema migration : https://en.wikipedia.org/wiki/Schema_migration
108
+ .. _DDLDatabase - Code generation from SQL files : https://www.jooq.org/doc/latest/manual/code-generation/codegen-ddl/
77
109
.. _Different use cases for jOOQ : https://www.jooq.org/doc/latest/manual/getting-started/use-cases/
78
- .. _Dynamic SQL : https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql/
110
+ .. _Dynamic SQL API : https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql/
111
+ .. _Flyway : https://github.com/flyway/flyway
79
112
.. _Gradle : https://gradle.org/
80
113
.. _Insight into Language Integrated Querying : https://blog.jooq.org/jooq-tuesdays-ming-yee-iu-gives-insight-into-language-integrated-querying/
114
+ .. _issue #10 - with reflection from the database : https://github.com/crate/cratedb-examples/pull/10
81
115
.. _Java 17 : https://adoptium.net/temurin/releases/?version=17
82
116
.. _jOOQ : https://github.com/jOOQ/jOOQ
83
117
.. _jOOQ as a SQL builder without code generation : https://www.jooq.org/doc/latest/manual/getting-started/use-cases/jooq-as-a-sql-builder-without-codegeneration/
84
118
.. _jOOQ's code generator : https://www.jooq.org/doc/latest/manual/code-generation/
85
119
.. _jOOQ DSL API : https://www.jooq.org/doc/latest/manual/sql-building/dsl-api/
86
120
.. _LINQ : https://en.wikipedia.org/wiki/Language_Integrated_Query
121
+ .. _Liquibase : https://github.com/liquibase/liquibase
87
122
.. _PostgreSQL JDBC Driver : https://github.com/pgjdbc/pgjdbc
0 commit comments