At some point I decided to eliminate some of these problems by making one simple decision: I stopped using an ORM tool for read-only operations. When I was looking for alternative way to implement read-only queries, I ran into jOOQ.

jOOQ is a library which helps you to get back in control of your SQL. It can generate code from your database and lets you build typesafe database queries by using its fluent API.

jOOQ helps you to solve the performance problems caused by ORM tools because you (and not the ORM tool) decide what kind of SQL queries your applications executes against its database.

You can of course solve these problems by using JDBC but this creates few new problems:

Writing SQL queries manually is time consuming.

Writing SQL queries manually is error prone because errors are detected at run time.

Writing SQL queries manually creates a vendor lock-in.

jOOQ solves every one of these problems!

Are you excited? I though so.

Introducing: Using jOOQ With Spring

This five part tutorial will help you get started with jOOQ and it consists of the following blog posts:

Using jOOQ With Spring: Configuration describes how you can get the required dependencies with Maven, transform jOOQ specific exceptions to Spring DataAccessExceptions, and configure the persistence layer of your application by using Java configuration.

If enjoyed reading this tutorial, you might want to take a look at my Spring Data book.

Other Resources

This section showcases useful material created by other developers. If you have written a blog post or recorded a video about jOOQ, and want to include it to this section, ping me on Twitter and I will check it out. If I think that it is useful, I will add it to this section.

jOOQ – Type safe DB querying on JCG Academy. This FREE course has a five star rating, and it is written by Lukas Eder (The creator of jOOQ). Check it out!