The Many Different Ways to Fetch Data in jOOQ

The jOOQ API is all about convenience, and as such, an important operation (the most important one?) like fetch() must come with convenience, too. The default way to fetch data is this: Result<Record1<String>> result = ctx.select(BOOK.TITLE) .from(BOOK) .fetch(); for (Record1<String> record : result) { // ... } It fetches the entire result set into memory … Continue reading The Many Different Ways to Fetch Data in jOOQ

Use jOOλ’s Sneaky Throw to Avoid Checked Exceptions

Don't you hate how you have to wrap checked exception throwing code in static initialisers? E.g. you cannot write this in Java: public class Test { static final Class<?> klass = Class.forName("org.h2.Driver"); } There's an unhandled ClassNotFoundException, and you can't catch / rethrow it simply. A static initialiser is needed: public class Test { static … Continue reading Use jOOλ’s Sneaky Throw to Avoid Checked Exceptions

Use ResultQuery.collect() to Implement Powerful Mappings

In our opinion, any Iterable<T> should offer a <R> collect(Collector<T, ?, R>) method to allow for transforming the the content to something else using standard JDK collectors, jOOλ collectors from org.jooq.lambda.Agg or your own. When using jOOQ, you don't have to wait for the JDK to finally add these useful utilities to the Iterable API. … Continue reading Use ResultQuery.collect() to Implement Powerful Mappings

jOOQ Tuesdays: Mario Fusco Talks About Functional and Declarative Programming

Welcome to the jOOQ Tuesdays series. In this series, we’ll publish an article on the third Tuesday every other 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 related topics. I'm very excited to … Continue reading jOOQ Tuesdays: Mario Fusco Talks About Functional and Declarative Programming

Using Oracle AQ via Java 8 Streams

One of the most awesome features of the Oracle database is Oracle AQ: Oracle Database Advanced Queuing. The AQ API implements a full fledged, transactional messaging system directly in the database. In a classic architecture where the database is at the center of your system, with multiple applications (some of which written in Java, others … Continue reading Using Oracle AQ via Java 8 Streams

The Danger of Subtype Polymorphism Applied to Tuples

Java 8 has lambdas and streams, but no tuples, which is a shame. This is why we have implemented tuples in jOOλ - Java 8's missing parts. Tuples are really boring value type containers. Essentially, they're just an enumeration of types like these: public class Tuple2<T1, T2> { public final T1 v1; public final T2 … Continue reading The Danger of Subtype Polymorphism Applied to Tuples

Common SQL Clauses and Their Equivalents in Java 8 Streams

Functional programming allows for quasi-declarative programming in a general purpose language. By using powerful fluent APIs like Java 8's Stream API, or jOOλ's sequential Stream extension Seq or more sophisticated libraries like vavr or functionaljava, we can express data transformation algorithms in an extremely concise way. Compare Mario Fusco's imperative and functional version of the … Continue reading Common SQL Clauses and Their Equivalents in Java 8 Streams

When the Java 8 Streams API is not Enough

Java 8 was - as always - a release of compromises and backwards-compatibility. A release where the JSR-335 expert group might not have agreed upon scope or feasibility of certain features with some of the audience. See some concrete explanations by Brian Goetz about why ... ... "final" is not allowed in Java 8 default … Continue reading When the Java 8 Streams API is not Enough

Java 8 Friday: More Functional Relational Transformation

In the past, we've been providing you with a new article every Friday about what's new in Java 8. It has been a very exciting blog series, but we would like to focus again more on our core content, which is Java and SQL. We will still be occasionally blogging about Java 8, but no … Continue reading Java 8 Friday: More Functional Relational Transformation

Java 8 Friday: The Best Java 8 Resources – Your Weekend is Booked

At Data Geekery, we love Java. And as we're really into jOOQ's fluent API and query DSL, we're absolutely thrilled about what Java 8 will bring to our ecosystem. Every Friday, we're showing you a couple of nice new tutorial-style Java 8 features, which take advantage of lambda expressions, method references, default methods, the Streams … Continue reading Java 8 Friday: The Best Java 8 Resources – Your Weekend is Booked