Skip to content

Commit 2d42a3b

Browse files
committed
Driver/Java: Add information about jOOQ and JPA/Panache
1 parent 9227a39 commit 2d42a3b

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed

docs/_include/links.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
[Executable stack with Apache Kafka, Apache Flink, and CrateDB]: https://github.com/crate/cratedb-examples/tree/main/framework/flink/kafka-jdbcsink-java
3636
[Geospatial Data Model]: https://cratedb.com/data-model/geospatial
3737
[Geospatial Database]: https://cratedb.com/geospatial-spatial-database
38+
[Hibernate]: https://hibernate.org/
3839
[HNSW]: https://en.wikipedia.org/wiki/Hierarchical_navigable_small_world
3940
[HNSW paper]: https://arxiv.org/pdf/1603.09320
4041
[HoloViews]: https://www.holoviews.org/
@@ -45,6 +46,8 @@
4546
[inverted index]: https://en.wikipedia.org/wiki/Inverted_index
4647
[JDBC]: https://en.wikipedia.org/wiki/Java_Database_Connectivity
4748
[JOIN]: inv:crate-reference#sql_joins
49+
[jOOQ]: https://www.jooq.org/
50+
[JPA]: https://en.wikipedia.org/wiki/Jakarta_Persistence
4851
[JSON Database]: https://cratedb.com/solutions/json-database
4952
[kNN]: https://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm
5053
[LangChain and CrateDB: Code Examples]: https://github.com/crate/cratedb-examples/tree/main/topic/machine-learning/langchain

docs/connect/java.md

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public class Main {
173173
```
174174
:::
175175

176-
## Example
176+
## JDBC example
177177

178178
:::{card}
179179
:link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-jdbc
@@ -185,7 +185,63 @@ Demonstrates a basic example using both the vanilla PostgreSQL JDBC Driver
185185
and the CrateDB JDBC Driver.
186186
:::
187187

188-
## Further reading
188+
[![Java: JDBC, QA](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-maven.yml)
189+
190+
191+
## Hibernate / JPA
192+
193+
:::{div}
194+
[Hibernate] is the top dog ORM for Java, supporting a range of databases,
195+
including PostgreSQL. [JPA], or Jakarta Persistence API (formerly Java
196+
Persistence API), is a Java specification that simplifies the process of
197+
mapping Java objects to relational databases.
198+
:::
199+
200+
:::{card}
201+
:link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-quarkus-panache
202+
:link-type: url
203+
{material-outlined}`play_arrow;2em`
204+
Connect to CrateDB and CrateDB Cloud using JPA and Panache.
205+
+++
206+
How CrateDB can be utilized with Quarkus in a very intuitive way
207+
using the Hibernate ORM deriving from PostgreSQL.
208+
:::
209+
210+
## jOOQ
211+
212+
:::{div}
213+
[jOOQ] is an internal DSL and source code generator, modelling the SQL
214+
language as a type-safe Java API to help you write better SQL.
215+
:::
216+
217+
```java
218+
// Fetch records, with filtering and sorting.
219+
Result<Record> result = db.select()
220+
.from(AUTHOR)
221+
.where(AUTHOR.NAME.like("Ja%"))
222+
.orderBy(AUTHOR.NAME)
223+
.fetch();
224+
225+
// Iterate and display records.
226+
for (Record record : result) {
227+
Integer id = record.getValue(AUTHOR.ID);
228+
String name = record.getValue(AUTHOR.NAME);
229+
System.out.println("id: " + id + ", name: " + name);
230+
}
231+
```
232+
233+
:::{card}
234+
:link: https://github.com/crate/cratedb-examples/tree/main/by-language/java-jooq
235+
:link-type: url
236+
{material-outlined}`play_arrow;2em`
237+
Connect to CrateDB and CrateDB Cloud using jOOQ.
238+
+++
239+
Java jOOQ demo application with CrateDB using PostgreSQL JDBC.
240+
:::
241+
242+
[![Java jOOQ](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-jooq.yml/badge.svg)](https://github.com/crate/cratedb-examples/actions/workflows/lang-java-jooq.yml)
243+
244+
## Software testing
189245

190246
For testing Java applications against CrateDB, see also documentation
191247
about {ref}`java-junit` and {ref}`testcontainers`.

0 commit comments

Comments
 (0)