How to Detect Slow Queries with jOOQ

Just now, we implemented a nice little feature in jOOQ's code generator: https://github.com/jOOQ/jOOQ/issues/4974 It detects whenever the jOOQ code generator runs a slow query to reverse engineer schema meta information. Why? In our development and integration test environment, we don't have huge schemas with all the different performance edge cases put in place. For instance, … Continue reading How to Detect Slow Queries with jOOQ

How to Pattern-Match Files and Display Adjacent Lines in Java

Recently, we've published our article about the awesome window function support in jOOλ 0.9.9, which I believe is some of the best additions to the library that we've ever done. Today, we'll look into an awesome application of window functions in a use-case that is inspired by this Stack Overflow question Sean Nguyen: How to … Continue reading How to Pattern-Match Files and Display Adjacent Lines in Java

Use JUnit’s expected exceptions sparingly

Sometimes, when we get pull requests for jOOQ or our other libraries, people change the code in our unit tests to be more "idiomatic JUnit". In particular, this means that they tend to change this (admittedly not so pretty code): @Test public void testValueOfIntInvalid() { try { ubyte((UByte.MIN_VALUE) - 1); fail(); } catch (NumberFormatException e) … Continue reading Use JUnit’s expected exceptions sparingly

Impress Your Coworkers by Using SQL UNPIVOT!

I've recently encountered a very interesting question on Stack Overflow by an unnamed user. The question was about generating a table of the following form in Oracle, using a table valued function: Description COUNT ------------------- TEST1 10 TEST2 15 TEST3 25 TEST4 50 The logic that should be implemented for the COUNT column is the … Continue reading Impress Your Coworkers by Using SQL UNPIVOT!

Reactive Database Access – Part 3 – Using jOOQ with Scala, Futures and Actors

Notice that the examples in this article may be outdated, as Typesafe's Activator works differently now. The blog post will not be maintained to provide up-to-date Activator examples. We're very happy to continue our a guest post series on the jOOQ blog by Manuel Bernhardt. In this blog series, Manuel will explain the motivation behind … Continue reading Reactive Database Access – Part 3 – Using jOOQ with Scala, Futures and Actors

If Java Were Designed Today: The Synchronizable Interface

Java has come a long way. A very long way. And it carries with it all the "junk" from early day design decisions. One thing that has been regretted time and again is the fact that every object (potentially) contains a monitor. This is hardly ever necessary and this flaw was corrected, finally, in Java … Continue reading If Java Were Designed Today: The Synchronizable Interface

2016 Will be the Year Remembered as When Java Finally Had Window Functions!

You heard right. Up until now, the awesome window functions were a feature uniquely reserved to SQL. Even sophisticated functional programming languages still seem to lack this beautiful functionality (correct me if I'm wrong, Haskell folks). We've written tons of blog posts about window functions, evangelising them to our audience, in articles like: Probably the … Continue reading 2016 Will be the Year Remembered as When Java Finally Had Window Functions!

A Curious Incidence of a jOOQ API Design Flaw

jOOQ is an internal domain-specific language (DSL), modelling the SQL language (external DSL) in Java (the host language). The main mechanism of the jOOQ API is described in this popular article: The Java Fluent API Designer Crash Course. Anyone can implement an internal DSL in Java (or in most other host languages) according to the … Continue reading A Curious Incidence of a jOOQ API Design Flaw