The Awesome PostgreSQL 9.4 / SQL:2003 FILTER Clause for Aggregate Functions

Sometimes when aggregating data with SQL, we'd love to add some additional filters. For instance, consider the following world bank data: GDP per capita (current US$) 2009 2010 2011 2012 CA 40,764 47,465 51,791 52,409 DE 40,270 40,408 44,355 42,598 FR 40,488 39,448 42,578 39,759 GB 35,455 36,573 38,927 38,649 IT 35,724 34,673 36,988 33,814 … Continue reading The Awesome PostgreSQL 9.4 / SQL:2003 FILTER Clause for Aggregate Functions

Leaky Abstractions, or How to Bind Oracle DATE Correctly with Hibernate

We've recently published an article about how to bind the Oracle DATE type correctly in SQL / JDBC, and jOOQ. This article got a bit of traction on reddit with an interesting remark by Vlad Mihalcea, who is frequently blogging about Hibernate, JPA, transaction management and connection pooling on his blog. Vlad pointed out that … Continue reading Leaky Abstractions, or How to Bind Oracle DATE Correctly with Hibernate

Are You Binding Your Oracle DATEs Correctly? I Bet You Aren’t

Oracle database has its ways. In my SQL talks at conferences, I love to confuse people with the following Oracle facts: ... and the answer is, of course: Isn't it horrible to make empty string the same thing as NULL? Please, Oracle... The only actually reasonable slide to follow the previous two is this one: … Continue reading Are You Binding Your Oracle DATEs Correctly? I Bet You Aren’t

A True SQL Gem You Didn’t Know Yet: The EVERY() Aggregate Function

We've just added support for the EVERY() aggregate function (#1391) to jOOQ, and would like to take the opportunity of letting you know of this true SQL gem that can come in handy EVERY(now and then) (pun intended). Let's assume we have four books in our table: INSERT INTO book VALUES (1, 1, '1984'); INSERT … Continue reading A True SQL Gem You Didn’t Know Yet: The EVERY() Aggregate Function

jOOQ Tuesdays: Yalım Gerger brings Git to Oracle

We're excited to launch a new series on our blog: the jOOQ Tuesdays. In this series, we'll publish an article on the third Tuesday every month where we interview someone we find exciting in our industry from a jOOQ perspective. This includes people who work with SQL, Java, Open Source, and a variety of other … Continue reading jOOQ Tuesdays: Yalım Gerger brings Git to Oracle

Really Too Bad that Java 8 Doesn’t Have Iterable.stream()

This is one of the more interesting recent Stack Overflow questions: Why does Iterable not provide stream() and parallelStream() methods? At first, it might seem intuitive to make it straight-forward to convert an Iterable into a Stream, because the two are really more or less the same thing for 90% of all use-cases. Granted, the … Continue reading Really Too Bad that Java 8 Doesn’t Have Iterable.stream()

The Inconvenient Truth About Dynamic vs. Static Typing

Sometimes there are these moments of truth. They happen completely unexpectedly, such as when I read this tweet: https://twitter.com/whileydave/status/536422407297171457 David is the author of the lesser-known but not at all lesser-interesting Whiley programming language, a language that has a lot of static type checking built in it. One of the most interesting features of the … Continue reading The Inconvenient Truth About Dynamic vs. Static Typing

Don’t be “Clever”: The Double Curly Braces Anti Pattern

From time to time, I find someone using the double curly braces anti pattern (also called double brace initialisation) in the wild. This time on Stack Overflow: Map source = new HashMap(){{ put("firstName", "John"); put("lastName", "Smith"); put("organizations", new HashMap(){{ put("0", new HashMap(){{ put("id", "1234"); }}); put("abc", new HashMap(){{ put("id", "5678"); }}); }}); }}; In case … Continue reading Don’t be “Clever”: The Double Curly Braces Anti Pattern

Do You Really Understand SQL’s GROUP BY and HAVING clauses?

There are some things in SQL that we simply take for granted without thinking about them properly. One of these things are the GROUP BY and the less popular HAVING clauses. Let's look at a simple example. For this example, we'll reiterate the example database we've seen in this previous article about the awesome LEAD(), … Continue reading Do You Really Understand SQL’s GROUP BY and HAVING clauses?

How to Integrate Commercial Third-Party Artefacts into Your Maven Build

According to a recent survey by ZeroTurnaround's RebelLabs, Maven is still the leading Java build platform. The current market share distribution, according to RebelLabs is: Maven with 64% Ant + Ivy with 16.5% Gradle with 11% Yet, at the same time, Maven is often criticised for being a bit obscure and intrusive. Compared to runner-ups … Continue reading How to Integrate Commercial Third-Party Artefacts into Your Maven Build