SlideShare a Scribd company logo
1 of 61
Download to read offline
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Get Back in Control of your SQL
SQL and Java could work
together so much better if
we only let them.
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Our vision at Data Geekery
- SQL dominates database systems
- SQL is very expressive
- SQL is very type safe
SQL is a device whose mystery is
only exceeded by its power!
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Me – @lukaseder
Java developers can get back in
control of SQL with jOOQ
- Head of R&D at Data Geekery GmbH
- SQL Aficionado
- Java Aficionado
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Legal
THE FOLLOWING IS COMMUNICATED TO YOU
SOLELY FOR ENTERTAINMENT PURPOSES. NO
ONE SANE WOULD BELIEVE A GUY WHO CLAIMS
HE IS A SQL AFICIONADO OR WORSE WHO CLAIMS
THAT SQL IS ANYTHING NEAR BEAUTIFUL. IF YOU
STILL FIND THE FOLLOWING INTERESTING AND IF
YOU BASE YOUR PURCHASING DECISIONS UPON
THAT, YOU DEFINITELY NEED PROFESSIONAL HELP.
WE ACTUALLY PROVIDE SUCH HELP.
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
SQL and Java – in theory
Java SQL
In this metaphor, electricity is the data (SQL) that
flows into your appliance / application (Java)
one jack one plug
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
SQL and Java – in practice
Java SQL
Images from: http://en.wikipedia.org/wiki/AC_power_plugs_and_sockets. License: public domain
one jack lots of plugs
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
JDBC
PreparedStatement stmt = connection.prepareStatement(
"SELECT text FROM products WHERE cust_id = ? AND value < ?");
stmt.setInt(1, custID);
stmt.setBigDecimal(2, BigDecimal.ZERO);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
System.out.println(rs.getString("TEXT"));
}
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
JDBC – the naked truth
01: PreparedStatement stmt = connection.prepareStatement(
02: "SELECT p.text txt" +
03: (isAccount ? ", NVL(a.type, ?) " : "") +
04: "FROM products p " +
05: (isAccount ? " INNER JOIN accounts a USING (prod_id) " : "") +
06: " WHERE p.cust_id = ? AND p.value < ?" +
07: (isAccount ? " AND a.type LIKE '%" + type + "%'" : "");
08: stmt.setInt(1, defaultType);
09: stmt.setInt(2, custID);
10: stmt.setBigDecimal(3, BigDecimal.ZERO);
11: ResultSet rs = stmt.executeQuery();
12:
13: while (rs.next()) {
14: Clob clob = rs.getClob("TEXT");
15: System.out.println(clob.getSubString(1, (int) clob.length());
16: }
17:
18: rs.close();
19: stmt.close();
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
JDBC – the naked truth
01: PreparedStatement stmt = connection.prepareStatement( //
02: "SELECT p.text txt" + //
03: (isAccount ? ", NVL(a.type, ?) " : "") + //
04: "FROM products p " + // Syntax error when isAccount == false
05: (isAccount ? " INNER JOIN accounts a USING (prod_id) " : "") + //
06: " WHERE p.cust_id = ? AND p.value < ?" + //
07: (isAccount ? " AND a.type LIKE '%" + type + "%'" : ""); // Syntax error and SQL injection possible
08: stmt.setInt(1, defaultType); // Wrong bind index
09: stmt.setInt(2, custID); //
10: stmt.setBigDecimal(3, BigDecimal.ZERO); //
11: ResultSet rs = stmt.executeQuery(); //
12:
13: while (rs.next()) { //
14: Clob clob = rs.getClob("TEXT"); // Wrong column name
15: System.out.println(clob.getSubString(1, (int) clob.length()); // ojdbc6: clob.free() should be called
16: } //
17:
18: rs.close(); // close() not really in finally block
19: stmt.close(); //
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
What JDBC means for developers
Images from Flickr. To the left by: Matthew Straubmuller, Greg Grossmeier. License: CC BY SA 2.0. Electric Engineers to the right copyright by Marco Sarli, all rights reserved.
With JDBC, your developers have to do a lot of
manual, error-prone (dangerous) and inefficient work
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
EJB 2.0 EntityBeans
public interface CustomerRequest extends EJBObject {
BigInteger getId();
String getText();
void setText(String text);
@Override
void remove();
}
public interface CustomerRequestHome extends EJBHome {
CustomerRequest create(BigInteger id);
CustomerRequest find(BigInteger id);
}
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
EJB 2.0 – the naked truth
<weblogic-enterprise-bean>
<ejb-name>com.example.CustomerRequestHome</ejb-name>
<entity-descriptor>
<pool>
<max-beans-in-free-pool>100</max-beans-in-free-pool>
</pool>
<entity-cache>
<max-beans-in-cache>500</max-beans-in-cache>
<idle-timeout-seconds>10</idle-timeout-seconds>
<concurrency-strategy>Database</concurrency-strategy>
</entity-cache>
<persistence>
<delay-updates-until-end-of-tx>True</delay-updates-until-end-of-tx>
</persistence>
<entity-clustering>
<home-is-clusterable>False</home-is-clusterable>
<home-load-algorithm>round-robin</home-load-algorithm>
</entity-clustering>
</entity-descriptor>
<transaction-descriptor/>
<enable-call-by-reference>True</enable-call-by-reference>
<jndi-name>com.example.CustomerRequestHome</jndi-name>
</weblogic-enterprise-bean>
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Hibernate – ORM
Session session = sessionFactory.openSession();
session.beginTransaction();
session.save(new Event("Conference", new Date());
session.save(new Event("After Party", new Date());
List result = session.createQuery("from Event").list();
for (Event event : (List<Event>) result) {
System.out.println("Event : " + event.getTitle());
}
session.getTransaction().commit();
session.close();
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Hibernate – «navigation»
List result = session.createQuery("from Event").list();
for (Event event : (List<Event>) result) {
System.out.println("Participants of " + event);
for (Person person : event.getParticipants()) {
Company company = person.getCompany();
System.out.println(person + " (" + company + ")");
}
}
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Hibernate – the naked truth
<hibernate-mapping package="org.hibernate.tutorial.hbm">
<class name="Event" table="EVENTS">
<id name="id" column="EVENT_ID">
<generator class="increment"/>
</id>
<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>
<set name="participants" inverse="true">
<key column="eventId"/>
<one-to-many entity-name="Person"/>
</set>
</class>
</hibernate-mapping>
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
JPA and EJB 3.0
EntityManager em = factory.createEntityManager();
em.getTransaction().begin();
em.persist(new Event("Conference", new Date());
em.persist(new Event("After Party", new Date());
List result = em.createQuery("from Event").getResultList();
for (Event event : (List<Event>) result) {
System.out.println("Event : " + event.getTitle());
}
em.getTransaction().commit();
em.close();
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
EJB 3.0 – the naked truth
@Entity @Table(name = "EVENTS")
public class Event {
private Long id;
private String title;
private Date date;
@Id @GeneratedValue(generator = "increment")
@GenericGenerator(name = "increment", strategy = "increment")
public Long getId() { /* … */ }
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "EVENT_DATE")
public Date getDate() { /* … */ }
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
EJB 3.0 – Annotatiomania™
@OneToMany(mappedBy = "destCustomerId")
@ManyToMany
@Fetch(FetchMode.SUBSELECT)
@JoinTable(
name = "customer_dealer_map",
joinColumns = {
@JoinColumn(name = "customer_id", referencedColumnName = "id")
},
inverseJoinColumns = {
@JoinColumn(name = "dealer_id", referencedColumnName = "id")
}
)
private Collection dealers;
Found at http://stackoverflow.com/q/17491912/521799
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
JPA 3.0 Preview – Annotatiomania™
@OneToMany @OneToManyMore @AnyOne @AnyBody
@ManyToMany @Many
@Fetch @FetchMany @FetchWithDiscriminator(name = "no_name")
@JoinTable(joinColumns = {
@JoinColumn(name = "customer_id", referencedColumnName = "id")
})
@PrefetchJoinWithDiscriminator
@IfJoiningAvoidHashJoins @ButUseHashJoinsWhenMoreThan(records = 1000)
@XmlDataTransformable @SpringPrefechAdapter
private Collection employees;
Might not be true
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
What JPA means for developers…
Images from Wikimedia. License: public domain. High voltage power lines by Simon Koopmann. License: CC-BY SA 3.0
With JPA, your developers use a huge framework with
lots of complexity that can get hard to manage
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
… when developers actually wanted this
Java SQL
one jack one plug
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Note, we’re talking about SQL. Not Persistence…
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
NoSQL?
…
… so, should we maybe abandon SQL?
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Seen at the O’Reilly Strata Conf:
History of NoSQL by Mark Madsen. Picture published by Edd Dumbill
NoSQL? No, SQL!
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
NoSQL for Big Data?
- You’re giving up on ACID
- You’re giving up on type safety
- You’re giving up on standards
- You’re giving up on tooling
- You’re giving up on relational algebra
- You haven’t asked operations
- You don’t actually have «Big Data»
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
NoSQL for Big Data?
- You’re giving up on ACID
- You’re giving up on type safety
- You’re giving up on standards
- You’re giving up on tooling
- You’re giving up on relational algebra
- You haven’t asked operations
- You don’t actually have «Big Data»
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Let’s calculate a running total
| ID | VALUE_DATE | AMOUNT |
|------|------------|--------|
| 9997 | 2014-03-18 | 99.17 |
| 9981 | 2014-03-16 | 71.44 |
| 9979 | 2014-03-16 | -94.60 |
| 9977 | 2014-03-16 | -6.96 |
| 9971 | 2014-03-15 | -65.95 |
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Let’s calculate a running total
| ID | VALUE_DATE | AMOUNT | BALANCE |
|------|------------|--------|------------|
| 9997 | 2014-03-18 | 99.17 | 19985.81 |
| 9981 | 2014-03-16 | 71.44 | 19886.64 |
| 9979 | 2014-03-16 | -94.60 | 19815.20 |
| 9977 | 2014-03-16 | -6.96 | 19909.80 |
| 9971 | 2014-03-15 | -65.95 | 19916.76 |
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Let’s calculate a running total
| ID | VALUE_DATE | AMOUNT | BALANCE |
|------|------------|--------|------------|
| 9997 | 2014-03-18 | +99.17 =19985.81 |
| 9981 | 2014-03-16 | 71.44 | +19886.64 |
| 9979 | 2014-03-16 | -94.60 | 19815.20 |
| 9977 | 2014-03-16 | -6.96 | 19909.80 |
| 9971 | 2014-03-15 | -65.95 | 19916.76 |
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Let’s calculate a running total
| ID | VALUE_DATE | AMOUNT | BALANCE |
|------|------------|--------|------------|
| 9997 | 2014-03-18 | 99.17 | 19985.81 |
| 9981 | 2014-03-16 | +71.44 =19886.64 |
| 9979 | 2014-03-16 | -94.60 | +19815.20 |
| 9977 | 2014-03-16 | -6.96 | 19909.80 |
| 9971 | 2014-03-15 | -65.95 | 19916.76 |
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Let’s calculate a running total
| ID | VALUE_DATE | AMOUNT | BALANCE |
|------|------------|--------|------------|
| 9997 | 2014-03-18 | 99.17 | 19985.81 |
| 9981 | 2014-03-16 | +71.44 =19886.64 | n
| 9979 | 2014-03-16 | -94.60 | +19815.20 | n+1
| 9977 | 2014-03-16 | -6.96 | 19909.80 |
| 9971 | 2014-03-15 | -65.95 | 19916.76 |BALANCE(ROWn) = BALANCE(ROWn+1) + AMOUNT(ROWn)
BALANCE(ROWn+1) = BALANCE(ROWn) – AMOUNT(ROWn)
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
SELECT
t.*,
t.current_balance - NVL(
SUM(t.amount) OVER (
PARTITION BY t.account_id
ORDER BY t.value_date DESC,
t.id DESC
ROWS BETWEEN UNBOUNDED PRECEDING
AND 1 PRECEDING
),
0) AS balance
FROM v_transactions t
WHERE t.account_id = 1
ORDER BY t.value_date DESC,
t.id DESC
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
WITH ordered_with_balance (
account_id, value_date, amount, balance, transaction_number
)
AS (
SELECT t1.account_id, t1.value_date, t1.amount, t1.current_balance,
t1.transaction_number
FROM v_transactions_by_time t1
WHERE t1.transaction_number = 1
UNION ALL
SELECT t1.account_id, t1.value_date, t1.amount, t2.balance - t2.amount,
t1.transaction_number
FROM ordered_with_balance t2
JOIN v_transactions_by_time t1
ON t1.transaction_number = t2.transaction_number + 1
AND t1.account_id = t2.account_id
)
SELECT *
FROM ordered_with_balance
WHERE account_id = 1
ORDER BY transaction_number ASC
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
SELECT account_id, value_date, amount, balance
FROM (
SELECT id, account_id, value_date, amount,
current_balance AS balance
FROM v_transactions
) t
WHERE account_id = 1
MODEL
PARTITION BY (account_id)
DIMENSION BY (
ROW_NUMBER() OVER (ORDER BY value_date DESC, id DESC) AS rn
)
MEASURES (value_date, amount, balance)
RULES (
balance[rn > 1] = balance[cv(rn) - 1] - amount[cv(rn) - 1]
)
ORDER BY rn ASC
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Stockholm Syndrome:
We love JavaScript SQL
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Winston Churchill:
SQL is the worst form of
database querying, except
for all the other forms.
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
SQL is so much more
| TEXT | VOTES | RANK | PERCENT |
|-------------|-------|------------|---------|
| Hibernate | 1383 | 1 | 32 % |
| jOOQ | 1029 | 2 | 23 % |
| EclipseLink | 881 | 3 | 20 % |
| JDBC | 533 | 4 | 12 % |
| Spring JDBC | 451 | 5 | 10 % |
Data may not be accurate…
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
SQL is so much more
SELECT p.text,
p.votes,
DENSE_RANK() OVER (ORDER BY p.votes DESC) AS "rank",
LPAD(
(p.votes * 100 / SUM(p.votes) OVER ()) || ' %',
4, ' '
) AS "percent"
FROM poll_options p
WHERE p.poll_id = 12
ORDER BY p.votes DESC
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
The same with jOOQ
select (p.TEXT,
p.VOTES,
denseRank().over().orderBy(p.VOTES.desc()).as("rank"),
lpad(
p.VOTES.mul(100).div(sum(p.VOTES).over()).concat(" %"),
4, " "
).as("percent"))
.from (POLL_OPTIONS.as("p"))
.where (p.POLL_ID.eq(12))
.orderBy(p.VOTES.desc());
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
The same with jOOQ in Scala (!)
select (p.TEXT,
p.VOTES,
denseRank() over() orderBy(p.VOTES desc) as "rank",
lpad(
(p.VOTES * 100) / (sum(p.VOTES) over()) || " %",
4, " "
) as "percent")
from (POLL_OPTIONS as "p")
where (p.POLL_ID === 12)
orderBy (p.VOTES desc)
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
What jOOQ means for developers
Java SQL
one jack all plugs
jOOQ
one adaptor
With jOOQ, Java plugs into SQL intuitively, letting
your developers focus on business-logic again.
Images from Wikimedia. License: public domain. Travel converter by Cephira. License: CC-BY SA 3.0
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Examples
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
People always ask me
Why jOOQ ?
… true story, they do ask me that
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Don’t forget: Java 8 is the future!
functional and
declarative
data transformation
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
DSL.using(c)
.select(COLUMNS.TABLE_NAME, COLUMNS.COLUMN_NAME, COLUMNS.TYPE_NAME)
.from(COLUMNS)
.orderBy(COLUMNS.TABLE_CATALOG, COLUMNS.TABLE_SCHEMA, COLUMNS.TABLE_NAME, COLUMNS.ORDINAL_POSITION)
.fetch() // jOOQ ends here
.stream() // Streams start here
.collect(groupingBy(
r -> r.getValue(COLUMNS.TABLE_NAME),
LinkedHashMap::new,
mapping(
r -> new Column(r.getValue(COLUMNS.COLUMN_NAME), r.getValue(COLUMNS.TYPE_NAME)),
toList()
)
))
.forEach(
(table, columns) -> {
System.out.println(
"CREATE TABLE " + table + " (");
System.out.println(
columns.stream()
.map(col -> " " + col.name +
" " + col.type)
.collect(Collectors.joining(",n"))
);
System.out.println(");");
}
);
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
DSL.using(c)
.select(COLUMNS.TABLE_NAME, COLUMNS.COLUMN_NAME, COLUMNS.TYPE_NAME)
.from(COLUMNS)
.orderBy(COLUMNS.TABLE_CATALOG, COLUMNS.TABLE_SCHEMA, COLUMNS.TABLE_NAME, COLUMNS.ORDINAL_POSITION)
.fetch() // jOOQ ends here
.stream() // Streams start here
.collect(groupingBy(
r -> r.getValue(COLUMNS.TABLE_NAME),
LinkedHashMap::new,
mapping(
r -> new Column(r.getValue(COLUMNS.COLUMN_NAME), r.getValue(COLUMNS.TYPE_NAME)),
toList()
)
))
.forEach(
(table, columns) -> {
System.out.println(
"CREATE TABLE " + table + " (");
System.out.println(
columns.stream()
.map(col -> " " + col.name +
" " + col.type)
.collect(Collectors.joining(",n"))
);
System.out.println(");");
}
);
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
DSL.using(c)
.select(COLUMNS.TABLE_NAME, COLUMNS.COLUMN_NAME, COLUMNS.TYPE_NAME)
.from(COLUMNS)
.orderBy(COLUMNS.TABLE_CATALOG, COLUMNS.TABLE_SCHEMA, COLUMNS.TABLE_NAME, COLUMNS.ORDINAL_POSITION)
.fetch() // jOOQ ends here
.stream() // Streams start here
.collect(groupingBy(
r -> r.getValue(COLUMNS.TABLE_NAME),
LinkedHashMap::new,
mapping(
r -> new Column(r.getValue(COLUMNS.COLUMN_NAME), r.getValue(COLUMNS.TYPE_NAME)),
toList()
)
))
.forEach(
(table, columns) -> {
System.out.println(
"CREATE TABLE " + table + " (");
System.out.println(
columns.stream()
.map(col -> " " + col.name +
" " + col.type)
.collect(Collectors.joining(",n"))
);
System.out.println(");");
}
);
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
CREATE TABLE CATALOGS(
CATALOG_NAME VARCHAR
);
CREATE TABLE COLLATIONS(
NAME VARCHAR,
KEY VARCHAR
);
CREATE TABLE COLUMNS(
TABLE_CATALOG VARCHAR,
TABLE_SCHEMA VARCHAR,
TABLE_NAME VARCHAR,
COLUMN_NAME VARCHAR,
ORDINAL_POSITION INTEGER,
COLUMN_DEFAULT VARCHAR,
IS_NULLABLE VARCHAR,
...
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
People always ask me
Awesome!
Why jOOQ ?
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
And I say
Database first
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
And I say
Type safe JDBC
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
And I say
Code
Generation
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
And I say
Active Records
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
And I say
SQL AST
Transformation
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
And I say
SQL
Standardisation
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
And I say
Stored
Procedures
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
And I say
Performance!
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
«jOOQ» 10% discount code
And I say
Markus Winand from
Use-The-Index-Luke.com
ROI of 83’800% (time AND
money)
Achieve proper indexing and
performance in popular RDBMS
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
And I say
Java + SQL = jOOQ
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
Get jOOQ Now!
Play around with jOOQ now!
• Free and Open Source for Open Source
databases
More free Java / SQL knowledge on:
• Blog: http://blog.jooq.org
• Twitter: @JavaOOQ
Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0
Intro SQL and Java jOOQ Examples
That’s it folks

More Related Content

What's hot

Extending spring
Extending springExtending spring
Extending spring
Joshua Long
 

What's hot (20)

This isn't Richard Stallman's Open Source anymore
This isn't Richard Stallman's Open Source anymoreThis isn't Richard Stallman's Open Source anymore
This isn't Richard Stallman's Open Source anymore
 
Getting start Java EE Action-Based MVC with Thymeleaf
Getting start Java EE Action-Based MVC with ThymeleafGetting start Java EE Action-Based MVC with Thymeleaf
Getting start Java EE Action-Based MVC with Thymeleaf
 
Java Configuration Deep Dive with Spring
Java Configuration Deep Dive with SpringJava Configuration Deep Dive with Spring
Java Configuration Deep Dive with Spring
 
JavaFX Pitfalls
JavaFX PitfallsJavaFX Pitfalls
JavaFX Pitfalls
 
Greach 2019 - Creating Micronaut Configurations
Greach 2019 - Creating Micronaut ConfigurationsGreach 2019 - Creating Micronaut Configurations
Greach 2019 - Creating Micronaut Configurations
 
Vert.x - Reactive & Distributed [Devoxx version]
Vert.x - Reactive & Distributed [Devoxx version]Vert.x - Reactive & Distributed [Devoxx version]
Vert.x - Reactive & Distributed [Devoxx version]
 
Vertx - Reactive & Distributed
Vertx - Reactive & DistributedVertx - Reactive & Distributed
Vertx - Reactive & Distributed
 
Taking advantage of the Amazon Web Services (AWS) Family
Taking advantage of the Amazon Web Services (AWS) FamilyTaking advantage of the Amazon Web Services (AWS) Family
Taking advantage of the Amazon Web Services (AWS) Family
 
Extending spring
Extending springExtending spring
Extending spring
 
And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...
 
Play + scala + reactive mongo
Play + scala + reactive mongoPlay + scala + reactive mongo
Play + scala + reactive mongo
 
Physical web
Physical webPhysical web
Physical web
 
Java libraries you can't afford to miss
Java libraries you can't afford to missJava libraries you can't afford to miss
Java libraries you can't afford to miss
 
a Running Tour of Cloud Foundry
a Running Tour of Cloud Foundrya Running Tour of Cloud Foundry
a Running Tour of Cloud Foundry
 
ScalaDays 2014 - Reactive Scala 3D Game Engine
ScalaDays 2014 - Reactive Scala 3D Game Engine ScalaDays 2014 - Reactive Scala 3D Game Engine
ScalaDays 2014 - Reactive Scala 3D Game Engine
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 
The Cloud Foundry bootcamp talk from SpringOne On The Road - Europe
The Cloud Foundry bootcamp talk from SpringOne On The Road - EuropeThe Cloud Foundry bootcamp talk from SpringOne On The Road - Europe
The Cloud Foundry bootcamp talk from SpringOne On The Road - Europe
 
Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage - A detective story about running large web services (VISUG...Sherlock Homepage - A detective story about running large web services (VISUG...
Sherlock Homepage - A detective story about running large web services (VISUG...
 
Progressive What Apps?
Progressive What Apps?Progressive What Apps?
Progressive What Apps?
 
Spring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergrationSpring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergration
 

Similar to Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround

Get Back in Control of Your SQL - #33rdDegree
Get Back in Control of Your SQL - #33rdDegreeGet Back in Control of Your SQL - #33rdDegree
Get Back in Control of Your SQL - #33rdDegree
DataGeekery
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
Igor Bronovskyy
 
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForce
Ciklum Ukraine
 
Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)
Tom Diederich
 
Spca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesSpca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_libraries
NCCOMMS
 

Similar to Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround (20)

Get Back in Control of Your SQL - #33rdDegree
Get Back in Control of Your SQL - #33rdDegreeGet Back in Control of Your SQL - #33rdDegree
Get Back in Control of Your SQL - #33rdDegree
 
The jOOQ Talk at the JUG-HH in Hamburg, Jan 14, 2014
The jOOQ Talk at the JUG-HH in Hamburg, Jan 14, 2014The jOOQ Talk at the JUG-HH in Hamburg, Jan 14, 2014
The jOOQ Talk at the JUG-HH in Hamburg, Jan 14, 2014
 
Get Back in Control of your SQL
Get Back in Control of your SQLGet Back in Control of your SQL
Get Back in Control of your SQL
 
Best Way to Write SQL in Java
Best Way to Write SQL in JavaBest Way to Write SQL in Java
Best Way to Write SQL in Java
 
10 SQL Tricks that You Didn't Think Were Possible
10 SQL Tricks that You Didn't Think Were Possible10 SQL Tricks that You Didn't Think Were Possible
10 SQL Tricks that You Didn't Think Were Possible
 
NoSQL? No, SQL! – How to Calculate Running Totals - Our Talk at the JUGS Bern
NoSQL? No, SQL! – How to Calculate Running Totals - Our Talk at the JUGS BernNoSQL? No, SQL! – How to Calculate Running Totals - Our Talk at the JUGS Bern
NoSQL? No, SQL! – How to Calculate Running Totals - Our Talk at the JUGS Bern
 
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 202010 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForce
 
Going Offline with Gears And GWT
Going Offline with Gears And GWTGoing Offline with Gears And GWT
Going Offline with Gears And GWT
 
PHPUG Presentation
PHPUG PresentationPHPUG Presentation
PHPUG Presentation
 
Java EE 7 - Novidades e Mudanças
Java EE 7 - Novidades e MudançasJava EE 7 - Novidades e Mudanças
Java EE 7 - Novidades e Mudanças
 
Google App Engine Developer - Day4
Google App Engine Developer - Day4Google App Engine Developer - Day4
Google App Engine Developer - Day4
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)
 
Spca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_librariesSpca2014 hillier 3rd party_javascript_libraries
Spca2014 hillier 3rd party_javascript_libraries
 
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
TDC2017 | São Paulo - Trilha Java EE How we figured out we had a SRE team at ...
 
MeasureCamp IX (London) - 10 JavaScript Concepts for web analysts
MeasureCamp IX (London) - 10 JavaScript Concepts for web analystsMeasureCamp IX (London) - 10 JavaScript Concepts for web analysts
MeasureCamp IX (London) - 10 JavaScript Concepts for web analysts
 
Top 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesTop 10 Web Security Vulnerabilities
Top 10 Web Security Vulnerabilities
 
Sql Injection V.2
Sql Injection V.2Sql Injection V.2
Sql Injection V.2
 

Recently uploaded

VADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call meVADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call me
shivanisharma5244
 
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
makhmalhalaaay
 
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
baharayali
 
Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...
Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...
Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...
makhmalhalaaay
 
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
baharayali
 
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Amil Baba Naveed Bangali
 
Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...
Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...
Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...
No -1 Astrologer ,Amil Baba In Australia | Uk | Usa | Canada | Pakistan
 
Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...
Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...
Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...
baharayali
 

Recently uploaded (20)

Zulu - The Epistle of Ignatius to Polycarp.pdf
Zulu - The Epistle of Ignatius to Polycarp.pdfZulu - The Epistle of Ignatius to Polycarp.pdf
Zulu - The Epistle of Ignatius to Polycarp.pdf
 
VADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call meVADODARA CALL GIRL AVAILABLE 7568201473 call me
VADODARA CALL GIRL AVAILABLE 7568201473 call me
 
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
Professional Amil baba, Kala jadu specialist in Multan and Kala ilam speciali...
 
NoHo First Good News online newsletter May 2024
NoHo First Good News online newsletter May 2024NoHo First Good News online newsletter May 2024
NoHo First Good News online newsletter May 2024
 
Meaning of 22 numbers in Matrix Destiny Chart | 22 Energy Calculator
Meaning of 22 numbers in Matrix Destiny Chart | 22 Energy CalculatorMeaning of 22 numbers in Matrix Destiny Chart | 22 Energy Calculator
Meaning of 22 numbers in Matrix Destiny Chart | 22 Energy Calculator
 
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
 
Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...
Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...
Professional Amil baba, Black magic specialist in Lahore and Kala ilam expert...
 
Lesson 6 - Our Spiritual Weapons - SBS.pptx
Lesson 6 - Our Spiritual Weapons - SBS.pptxLesson 6 - Our Spiritual Weapons - SBS.pptx
Lesson 6 - Our Spiritual Weapons - SBS.pptx
 
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verifiedConnaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
 
Emails, Facebook, WhatsApp and the Dhamma (English and Chinese).pdf
Emails, Facebook, WhatsApp and the Dhamma  (English and Chinese).pdfEmails, Facebook, WhatsApp and the Dhamma  (English and Chinese).pdf
Emails, Facebook, WhatsApp and the Dhamma (English and Chinese).pdf
 
The Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docxThe Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docx
 
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
Top Kala Jadu, Bangali Amil baba in Lahore and Kala jadu specialist in Lahore...
 
Exploring the Meaning of Jesus’ Ascension
Exploring the Meaning of Jesus’ AscensionExploring the Meaning of Jesus’ Ascension
Exploring the Meaning of Jesus’ Ascension
 
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
Best Astrologer Vashikaran Specialist in Germany and France Black Magic Exper...
 
Genesis 1:5 - Meditate the Scripture Daily bit by bit
Genesis 1:5 - Meditate the Scripture Daily bit by bitGenesis 1:5 - Meditate the Scripture Daily bit by bit
Genesis 1:5 - Meditate the Scripture Daily bit by bit
 
Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...
Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...
Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...
 
Genesis 1:8 || Meditate the Scripture daily verse by verse
Genesis 1:8  ||  Meditate the Scripture daily verse by verseGenesis 1:8  ||  Meditate the Scripture daily verse by verse
Genesis 1:8 || Meditate the Scripture daily verse by verse
 
Peaceful Meditation | Peaceful Way by Kabastro
Peaceful Meditation | Peaceful Way by KabastroPeaceful Meditation | Peaceful Way by Kabastro
Peaceful Meditation | Peaceful Way by Kabastro
 
Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...
Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...
Famous Kala Jadu, Black magic specialist in Rawalpindi and Bangali Amil baba ...
 
Louise de Marillac and Care for the Elderly
Louise de Marillac and Care for the ElderlyLouise de Marillac and Care for the Elderly
Louise de Marillac and Care for the Elderly
 

Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround

  • 1. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Get Back in Control of your SQL SQL and Java could work together so much better if we only let them.
  • 2. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Our vision at Data Geekery - SQL dominates database systems - SQL is very expressive - SQL is very type safe SQL is a device whose mystery is only exceeded by its power!
  • 3. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Me – @lukaseder Java developers can get back in control of SQL with jOOQ - Head of R&D at Data Geekery GmbH - SQL Aficionado - Java Aficionado
  • 4. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Legal THE FOLLOWING IS COMMUNICATED TO YOU SOLELY FOR ENTERTAINMENT PURPOSES. NO ONE SANE WOULD BELIEVE A GUY WHO CLAIMS HE IS A SQL AFICIONADO OR WORSE WHO CLAIMS THAT SQL IS ANYTHING NEAR BEAUTIFUL. IF YOU STILL FIND THE FOLLOWING INTERESTING AND IF YOU BASE YOUR PURCHASING DECISIONS UPON THAT, YOU DEFINITELY NEED PROFESSIONAL HELP. WE ACTUALLY PROVIDE SUCH HELP.
  • 5. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples SQL and Java – in theory Java SQL In this metaphor, electricity is the data (SQL) that flows into your appliance / application (Java) one jack one plug
  • 6. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples SQL and Java – in practice Java SQL Images from: http://en.wikipedia.org/wiki/AC_power_plugs_and_sockets. License: public domain one jack lots of plugs
  • 7. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples JDBC PreparedStatement stmt = connection.prepareStatement( "SELECT text FROM products WHERE cust_id = ? AND value < ?"); stmt.setInt(1, custID); stmt.setBigDecimal(2, BigDecimal.ZERO); ResultSet rs = stmt.executeQuery(); while (rs.next()) { System.out.println(rs.getString("TEXT")); }
  • 8. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples JDBC – the naked truth 01: PreparedStatement stmt = connection.prepareStatement( 02: "SELECT p.text txt" + 03: (isAccount ? ", NVL(a.type, ?) " : "") + 04: "FROM products p " + 05: (isAccount ? " INNER JOIN accounts a USING (prod_id) " : "") + 06: " WHERE p.cust_id = ? AND p.value < ?" + 07: (isAccount ? " AND a.type LIKE '%" + type + "%'" : ""); 08: stmt.setInt(1, defaultType); 09: stmt.setInt(2, custID); 10: stmt.setBigDecimal(3, BigDecimal.ZERO); 11: ResultSet rs = stmt.executeQuery(); 12: 13: while (rs.next()) { 14: Clob clob = rs.getClob("TEXT"); 15: System.out.println(clob.getSubString(1, (int) clob.length()); 16: } 17: 18: rs.close(); 19: stmt.close();
  • 9. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples JDBC – the naked truth 01: PreparedStatement stmt = connection.prepareStatement( // 02: "SELECT p.text txt" + // 03: (isAccount ? ", NVL(a.type, ?) " : "") + // 04: "FROM products p " + // Syntax error when isAccount == false 05: (isAccount ? " INNER JOIN accounts a USING (prod_id) " : "") + // 06: " WHERE p.cust_id = ? AND p.value < ?" + // 07: (isAccount ? " AND a.type LIKE '%" + type + "%'" : ""); // Syntax error and SQL injection possible 08: stmt.setInt(1, defaultType); // Wrong bind index 09: stmt.setInt(2, custID); // 10: stmt.setBigDecimal(3, BigDecimal.ZERO); // 11: ResultSet rs = stmt.executeQuery(); // 12: 13: while (rs.next()) { // 14: Clob clob = rs.getClob("TEXT"); // Wrong column name 15: System.out.println(clob.getSubString(1, (int) clob.length()); // ojdbc6: clob.free() should be called 16: } // 17: 18: rs.close(); // close() not really in finally block 19: stmt.close(); //
  • 10. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples What JDBC means for developers Images from Flickr. To the left by: Matthew Straubmuller, Greg Grossmeier. License: CC BY SA 2.0. Electric Engineers to the right copyright by Marco Sarli, all rights reserved. With JDBC, your developers have to do a lot of manual, error-prone (dangerous) and inefficient work
  • 11. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples EJB 2.0 EntityBeans public interface CustomerRequest extends EJBObject { BigInteger getId(); String getText(); void setText(String text); @Override void remove(); } public interface CustomerRequestHome extends EJBHome { CustomerRequest create(BigInteger id); CustomerRequest find(BigInteger id); }
  • 12. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples EJB 2.0 – the naked truth <weblogic-enterprise-bean> <ejb-name>com.example.CustomerRequestHome</ejb-name> <entity-descriptor> <pool> <max-beans-in-free-pool>100</max-beans-in-free-pool> </pool> <entity-cache> <max-beans-in-cache>500</max-beans-in-cache> <idle-timeout-seconds>10</idle-timeout-seconds> <concurrency-strategy>Database</concurrency-strategy> </entity-cache> <persistence> <delay-updates-until-end-of-tx>True</delay-updates-until-end-of-tx> </persistence> <entity-clustering> <home-is-clusterable>False</home-is-clusterable> <home-load-algorithm>round-robin</home-load-algorithm> </entity-clustering> </entity-descriptor> <transaction-descriptor/> <enable-call-by-reference>True</enable-call-by-reference> <jndi-name>com.example.CustomerRequestHome</jndi-name> </weblogic-enterprise-bean>
  • 13. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Hibernate – ORM Session session = sessionFactory.openSession(); session.beginTransaction(); session.save(new Event("Conference", new Date()); session.save(new Event("After Party", new Date()); List result = session.createQuery("from Event").list(); for (Event event : (List<Event>) result) { System.out.println("Event : " + event.getTitle()); } session.getTransaction().commit(); session.close();
  • 14. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Hibernate – «navigation» List result = session.createQuery("from Event").list(); for (Event event : (List<Event>) result) { System.out.println("Participants of " + event); for (Person person : event.getParticipants()) { Company company = person.getCompany(); System.out.println(person + " (" + company + ")"); } }
  • 15. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Hibernate – the naked truth <hibernate-mapping package="org.hibernate.tutorial.hbm"> <class name="Event" table="EVENTS"> <id name="id" column="EVENT_ID"> <generator class="increment"/> </id> <property name="date" type="timestamp" column="EVENT_DATE"/> <property name="title"/> <set name="participants" inverse="true"> <key column="eventId"/> <one-to-many entity-name="Person"/> </set> </class> </hibernate-mapping>
  • 16. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples JPA and EJB 3.0 EntityManager em = factory.createEntityManager(); em.getTransaction().begin(); em.persist(new Event("Conference", new Date()); em.persist(new Event("After Party", new Date()); List result = em.createQuery("from Event").getResultList(); for (Event event : (List<Event>) result) { System.out.println("Event : " + event.getTitle()); } em.getTransaction().commit(); em.close();
  • 17. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples EJB 3.0 – the naked truth @Entity @Table(name = "EVENTS") public class Event { private Long id; private String title; private Date date; @Id @GeneratedValue(generator = "increment") @GenericGenerator(name = "increment", strategy = "increment") public Long getId() { /* … */ } @Temporal(TemporalType.TIMESTAMP) @Column(name = "EVENT_DATE") public Date getDate() { /* … */ }
  • 18. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples EJB 3.0 – Annotatiomania™ @OneToMany(mappedBy = "destCustomerId") @ManyToMany @Fetch(FetchMode.SUBSELECT) @JoinTable( name = "customer_dealer_map", joinColumns = { @JoinColumn(name = "customer_id", referencedColumnName = "id") }, inverseJoinColumns = { @JoinColumn(name = "dealer_id", referencedColumnName = "id") } ) private Collection dealers; Found at http://stackoverflow.com/q/17491912/521799
  • 19. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples JPA 3.0 Preview – Annotatiomania™ @OneToMany @OneToManyMore @AnyOne @AnyBody @ManyToMany @Many @Fetch @FetchMany @FetchWithDiscriminator(name = "no_name") @JoinTable(joinColumns = { @JoinColumn(name = "customer_id", referencedColumnName = "id") }) @PrefetchJoinWithDiscriminator @IfJoiningAvoidHashJoins @ButUseHashJoinsWhenMoreThan(records = 1000) @XmlDataTransformable @SpringPrefechAdapter private Collection employees; Might not be true
  • 20. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples What JPA means for developers… Images from Wikimedia. License: public domain. High voltage power lines by Simon Koopmann. License: CC-BY SA 3.0 With JPA, your developers use a huge framework with lots of complexity that can get hard to manage
  • 21. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples … when developers actually wanted this Java SQL one jack one plug
  • 22. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Note, we’re talking about SQL. Not Persistence…
  • 23. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples NoSQL? … … so, should we maybe abandon SQL?
  • 24. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Seen at the O’Reilly Strata Conf: History of NoSQL by Mark Madsen. Picture published by Edd Dumbill NoSQL? No, SQL!
  • 25. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples NoSQL for Big Data? - You’re giving up on ACID - You’re giving up on type safety - You’re giving up on standards - You’re giving up on tooling - You’re giving up on relational algebra - You haven’t asked operations - You don’t actually have «Big Data»
  • 26. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples NoSQL for Big Data? - You’re giving up on ACID - You’re giving up on type safety - You’re giving up on standards - You’re giving up on tooling - You’re giving up on relational algebra - You haven’t asked operations - You don’t actually have «Big Data»
  • 27. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Let’s calculate a running total | ID | VALUE_DATE | AMOUNT | |------|------------|--------| | 9997 | 2014-03-18 | 99.17 | | 9981 | 2014-03-16 | 71.44 | | 9979 | 2014-03-16 | -94.60 | | 9977 | 2014-03-16 | -6.96 | | 9971 | 2014-03-15 | -65.95 |
  • 28. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Let’s calculate a running total | ID | VALUE_DATE | AMOUNT | BALANCE | |------|------------|--------|------------| | 9997 | 2014-03-18 | 99.17 | 19985.81 | | 9981 | 2014-03-16 | 71.44 | 19886.64 | | 9979 | 2014-03-16 | -94.60 | 19815.20 | | 9977 | 2014-03-16 | -6.96 | 19909.80 | | 9971 | 2014-03-15 | -65.95 | 19916.76 |
  • 29. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Let’s calculate a running total | ID | VALUE_DATE | AMOUNT | BALANCE | |------|------------|--------|------------| | 9997 | 2014-03-18 | +99.17 =19985.81 | | 9981 | 2014-03-16 | 71.44 | +19886.64 | | 9979 | 2014-03-16 | -94.60 | 19815.20 | | 9977 | 2014-03-16 | -6.96 | 19909.80 | | 9971 | 2014-03-15 | -65.95 | 19916.76 |
  • 30. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Let’s calculate a running total | ID | VALUE_DATE | AMOUNT | BALANCE | |------|------------|--------|------------| | 9997 | 2014-03-18 | 99.17 | 19985.81 | | 9981 | 2014-03-16 | +71.44 =19886.64 | | 9979 | 2014-03-16 | -94.60 | +19815.20 | | 9977 | 2014-03-16 | -6.96 | 19909.80 | | 9971 | 2014-03-15 | -65.95 | 19916.76 |
  • 31. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Let’s calculate a running total | ID | VALUE_DATE | AMOUNT | BALANCE | |------|------------|--------|------------| | 9997 | 2014-03-18 | 99.17 | 19985.81 | | 9981 | 2014-03-16 | +71.44 =19886.64 | n | 9979 | 2014-03-16 | -94.60 | +19815.20 | n+1 | 9977 | 2014-03-16 | -6.96 | 19909.80 | | 9971 | 2014-03-15 | -65.95 | 19916.76 |BALANCE(ROWn) = BALANCE(ROWn+1) + AMOUNT(ROWn) BALANCE(ROWn+1) = BALANCE(ROWn) – AMOUNT(ROWn)
  • 32. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 SELECT t.*, t.current_balance - NVL( SUM(t.amount) OVER ( PARTITION BY t.account_id ORDER BY t.value_date DESC, t.id DESC ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING ), 0) AS balance FROM v_transactions t WHERE t.account_id = 1 ORDER BY t.value_date DESC, t.id DESC
  • 33. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 WITH ordered_with_balance ( account_id, value_date, amount, balance, transaction_number ) AS ( SELECT t1.account_id, t1.value_date, t1.amount, t1.current_balance, t1.transaction_number FROM v_transactions_by_time t1 WHERE t1.transaction_number = 1 UNION ALL SELECT t1.account_id, t1.value_date, t1.amount, t2.balance - t2.amount, t1.transaction_number FROM ordered_with_balance t2 JOIN v_transactions_by_time t1 ON t1.transaction_number = t2.transaction_number + 1 AND t1.account_id = t2.account_id ) SELECT * FROM ordered_with_balance WHERE account_id = 1 ORDER BY transaction_number ASC
  • 34. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 SELECT account_id, value_date, amount, balance FROM ( SELECT id, account_id, value_date, amount, current_balance AS balance FROM v_transactions ) t WHERE account_id = 1 MODEL PARTITION BY (account_id) DIMENSION BY ( ROW_NUMBER() OVER (ORDER BY value_date DESC, id DESC) AS rn ) MEASURES (value_date, amount, balance) RULES ( balance[rn > 1] = balance[cv(rn) - 1] - amount[cv(rn) - 1] ) ORDER BY rn ASC
  • 35. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Stockholm Syndrome: We love JavaScript SQL
  • 36. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Winston Churchill: SQL is the worst form of database querying, except for all the other forms.
  • 37. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples SQL is so much more | TEXT | VOTES | RANK | PERCENT | |-------------|-------|------------|---------| | Hibernate | 1383 | 1 | 32 % | | jOOQ | 1029 | 2 | 23 % | | EclipseLink | 881 | 3 | 20 % | | JDBC | 533 | 4 | 12 % | | Spring JDBC | 451 | 5 | 10 % | Data may not be accurate…
  • 38. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples SQL is so much more SELECT p.text, p.votes, DENSE_RANK() OVER (ORDER BY p.votes DESC) AS "rank", LPAD( (p.votes * 100 / SUM(p.votes) OVER ()) || ' %', 4, ' ' ) AS "percent" FROM poll_options p WHERE p.poll_id = 12 ORDER BY p.votes DESC
  • 39. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples The same with jOOQ select (p.TEXT, p.VOTES, denseRank().over().orderBy(p.VOTES.desc()).as("rank"), lpad( p.VOTES.mul(100).div(sum(p.VOTES).over()).concat(" %"), 4, " " ).as("percent")) .from (POLL_OPTIONS.as("p")) .where (p.POLL_ID.eq(12)) .orderBy(p.VOTES.desc());
  • 40. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples The same with jOOQ in Scala (!) select (p.TEXT, p.VOTES, denseRank() over() orderBy(p.VOTES desc) as "rank", lpad( (p.VOTES * 100) / (sum(p.VOTES) over()) || " %", 4, " " ) as "percent") from (POLL_OPTIONS as "p") where (p.POLL_ID === 12) orderBy (p.VOTES desc)
  • 41. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples What jOOQ means for developers Java SQL one jack all plugs jOOQ one adaptor With jOOQ, Java plugs into SQL intuitively, letting your developers focus on business-logic again. Images from Wikimedia. License: public domain. Travel converter by Cephira. License: CC-BY SA 3.0
  • 42. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Examples
  • 43. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples People always ask me Why jOOQ ? … true story, they do ask me that
  • 44. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Don’t forget: Java 8 is the future! functional and declarative data transformation
  • 45. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 DSL.using(c) .select(COLUMNS.TABLE_NAME, COLUMNS.COLUMN_NAME, COLUMNS.TYPE_NAME) .from(COLUMNS) .orderBy(COLUMNS.TABLE_CATALOG, COLUMNS.TABLE_SCHEMA, COLUMNS.TABLE_NAME, COLUMNS.ORDINAL_POSITION) .fetch() // jOOQ ends here .stream() // Streams start here .collect(groupingBy( r -> r.getValue(COLUMNS.TABLE_NAME), LinkedHashMap::new, mapping( r -> new Column(r.getValue(COLUMNS.COLUMN_NAME), r.getValue(COLUMNS.TYPE_NAME)), toList() ) )) .forEach( (table, columns) -> { System.out.println( "CREATE TABLE " + table + " ("); System.out.println( columns.stream() .map(col -> " " + col.name + " " + col.type) .collect(Collectors.joining(",n")) ); System.out.println(");"); } );
  • 46. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 DSL.using(c) .select(COLUMNS.TABLE_NAME, COLUMNS.COLUMN_NAME, COLUMNS.TYPE_NAME) .from(COLUMNS) .orderBy(COLUMNS.TABLE_CATALOG, COLUMNS.TABLE_SCHEMA, COLUMNS.TABLE_NAME, COLUMNS.ORDINAL_POSITION) .fetch() // jOOQ ends here .stream() // Streams start here .collect(groupingBy( r -> r.getValue(COLUMNS.TABLE_NAME), LinkedHashMap::new, mapping( r -> new Column(r.getValue(COLUMNS.COLUMN_NAME), r.getValue(COLUMNS.TYPE_NAME)), toList() ) )) .forEach( (table, columns) -> { System.out.println( "CREATE TABLE " + table + " ("); System.out.println( columns.stream() .map(col -> " " + col.name + " " + col.type) .collect(Collectors.joining(",n")) ); System.out.println(");"); } );
  • 47. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 DSL.using(c) .select(COLUMNS.TABLE_NAME, COLUMNS.COLUMN_NAME, COLUMNS.TYPE_NAME) .from(COLUMNS) .orderBy(COLUMNS.TABLE_CATALOG, COLUMNS.TABLE_SCHEMA, COLUMNS.TABLE_NAME, COLUMNS.ORDINAL_POSITION) .fetch() // jOOQ ends here .stream() // Streams start here .collect(groupingBy( r -> r.getValue(COLUMNS.TABLE_NAME), LinkedHashMap::new, mapping( r -> new Column(r.getValue(COLUMNS.COLUMN_NAME), r.getValue(COLUMNS.TYPE_NAME)), toList() ) )) .forEach( (table, columns) -> { System.out.println( "CREATE TABLE " + table + " ("); System.out.println( columns.stream() .map(col -> " " + col.name + " " + col.type) .collect(Collectors.joining(",n")) ); System.out.println(");"); } );
  • 48. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 CREATE TABLE CATALOGS( CATALOG_NAME VARCHAR ); CREATE TABLE COLLATIONS( NAME VARCHAR, KEY VARCHAR ); CREATE TABLE COLUMNS( TABLE_CATALOG VARCHAR, TABLE_SCHEMA VARCHAR, TABLE_NAME VARCHAR, COLUMN_NAME VARCHAR, ORDINAL_POSITION INTEGER, COLUMN_DEFAULT VARCHAR, IS_NULLABLE VARCHAR, ...
  • 49. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples People always ask me Awesome! Why jOOQ ?
  • 50. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples And I say Database first
  • 51. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples And I say Type safe JDBC
  • 52. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples And I say Code Generation
  • 53. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples And I say Active Records
  • 54. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples And I say SQL AST Transformation
  • 55. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples And I say SQL Standardisation
  • 56. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples And I say Stored Procedures
  • 57. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples And I say Performance!
  • 58. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples «jOOQ» 10% discount code And I say Markus Winand from Use-The-Index-Luke.com ROI of 83’800% (time AND money) Achieve proper indexing and performance in popular RDBMS
  • 59. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples And I say Java + SQL = jOOQ
  • 60. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples Get jOOQ Now! Play around with jOOQ now! • Free and Open Source for Open Source databases More free Java / SQL knowledge on: • Blog: http://blog.jooq.org • Twitter: @JavaOOQ
  • 61. Copyright (c) 2009-2014 by Data Geekery GmbH. Slides licensed under CC BY SA 3.0 Intro SQL and Java jOOQ Examples That’s it folks