17

jOOQ: The easiest way to write SQL in Java

 4 years ago
source link: https://www.jooq.org/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
main-img.jpg

jOOQ generates Java code from your database and lets you build type safe SQL queries through its fluent API.

select().from(t).where(row(t.a, t.b).eq(1, 2));
// Type-check here: ----------------->  ^^^^
select().from(t).where(row(t.a, t.b).overlaps(date1, date2));
// Type-check here: ------------------------> ^^^^^^^^^^^^
select().from(t).where(row(t.a, t.b).in(select(t2.x, t2.y)));
// Type-check here: -------------------------> ^^^^^^^^^^
update(t).set(row(t.a, t.b), select(t2.x, t2.y).where(...));
// Type-check here: --------------> ^^^^^^^^^^
insertInto(t, t.a, t.b).values(1, 2);
// Type-check here: ---------> ^^^^
lukas.jpg

Hi there!

You're probably asking yourself why we need yet another database abstraction software in Java. Fair question.

In our experience when writing applications against large and complex Oracle databases, Hibernate was not a good fit because we wanted to stay close to SQL:2008 and to Oracle's extensions.

JDBC, on the other hand is verbose and causes a lot of quality and security headaches.

So we rolled our own tailor-made little SQL builder. In fact, every company I have ever met rolled their own tailor-made SQL builder.

But our business was not to write SQL builders, our business was to write brokerage logic. E-Banking workflows. Customer relationship management. We didn't care about infrastructure, really.

And because we didn't really care about the SQL parts, no one maintained those SQL builders. We were overwhelmed.

That's why I created jOOQ.

jOOQ is a simple way to integrate the SQL language into Java in a way that allows for developers to write safe and quality SQL fast and directly in Java such that they can again focus on their business.

Today, I'm happy to say that jOOQ is the product that I was wishing for when I started to really understand SQL. And I'm also proud to say that thousands of happy jOOQ users agree.

Why don't you give jOOQ a free try. If you don't like it you don't pay.

Cheers, Lukas


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK