From 8dd098fb187c2c98bc1dae650072bb5b2313e4eb Mon Sep 17 00:00:00 2001
From: Lukas Eder
It's simple. With the jOOQ DSL, SQL looks almost as if it were natively supported by Java. For instance, get all books published in 2011, ordered by title
@@ -70,6 +70,56 @@ create.select(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, count()) +SQL is a very type safe language. So is jOOQ. jOOQ uniquely respects SQL's row value expression typesafety. jOOQ will use your Java compiler to type-check the following:
+ ++select().from(t).where(t.a.eq(select(t2.x).from(t2)); +// Type-check here: ---------------> ^^^^ +select().from(t).where(t.a.eq(any(select(t2.x).from(t2))); +// Type-check here: -------------------> ^^^^ +select().from(t).where(t.a.in(select(t2.x).from(t2)); +// Type-check here: ---------------> ^^^^ ++ +
And also set operations:
+ ++select(t1.a, t1.b).from(t1).union(select(t2.a, t2.b).from(t2)); +// Type-check here: -------------------> ^^^^^^^^^^ ++ +
And even row value expressions:
+ ++SELECT * FROM t WHERE (t.a, t.b) = (1, 2) + +SELECT * FROM t WHERE (t.a, t.b) OVERLAPS (date1, date2) + +SELECT * FROM t WHERE (t.a, t.b) IN (SELECT x, y FROM t2) + +UPDATE t SET (a, b) = (SELECT x, y FROM t2 WHERE ...) + +INSERT INTO t (a, b) VALUES (1, 2) + + |
+ +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).from(t2))); +// 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: ---------> ^^^^ + |
+
jOOQ stands for Java Object Oriented Querying. It combines these essential features:
@@ -102,10 +152,10 @@ create.select(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, count())