Java Object Oriented Querying

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 4 days ago

New blog articles detected

  • 10 Nice Examples of Writing SQL in Kotlin With jOOQ

    Kotlin is the next big thing. With Google announcing official support for Kotlin on Android, we’ll see a lot more traction for this lovely language. After today's #kotlin announcement, we're betting this tag will blow up just like Swift did. #io17. https://t.co/whOcJlJfWe pic.twitter.com/2QKEJIRYVi — Stack Overflow (@StackOverflow) May 17, 2017 We’ve already blogged about the…Read more 10 Nice Exa...

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 1 week ago

New blog articles detected

  • 10 Tips on How to be a Great Programmer

    I was recently asked in an interview about my opinion on how to be a great programmer. That’s an interesting question, and I think we can all be great programmers, regardless of our talent, if we follow a couple of rules that – I believe – should be common sense. In fact, these rules don’t…Read more 10 Tips on How to be a Great Programmer

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 1 week ago

New blog articles detected

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 2 weeks ago

New blog articles detected

  • Don’t Use the String Concatenation “Trick” in SQL Predicates

    In SQL, quite often, we want to compare several values with each other. For instance, when we’re looking for a specific user by their first and last names, we’ll write a query like this one: We’re getting: CUSTOMER_ID FIRST_NAME LAST_NAME ------------------------------------ 8 SUSAN WILSON Surely, everyone agrees that this is correct and perfectly fine as…Read more Don’t Use the String Concatenati...

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 1 month ago

New blog articles detected

  • How to Calculate Multiple Aggregate Functions in a Single Query

    At a customer site, I’ve recently encountered a report where a programmer needed to count quite a bit of stuff from a single table. The counts all differed in the way they used specific predicates. The report looked roughly like this (as always, I’m using the Sakila database for illustration): And then, unsurprisingly, combinations of…Read more How to Calculate Multiple Aggregate Functions in a Si...

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 1 month ago

New blog articles detected

  • jOOQ Tuesdays: Richard North Makes Database Testing More Reproducible with Testcontainers

    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…Read more jOOQ Tuesdays: Richard North Makes Database Testing More Reproducible ...

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 1 month ago

New blog articles detected

  • How to Fetch Multiple Oracle Execution Plans in One Nice Query

    When looking at execution plans in Oracle, we’ll have to do several steps to be able to call the DBMS_XPLAN package functions. In fact, we have to find out the SQL_ID for a given statement first, and only then we can get its plan. I’ve blogged about this previously, here. However, thanks to lateral unnesting,…Read more How to Fetch Multiple Oracle Execution Plans in One Nice Query

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 1 month ago

New blog articles detected

  • SQL IN Predicate: With IN List or With Array? Which is Faster?

    Hah! Got nerd-sniped again: http://stackoverflow.com/questions/43099226/how-to-make-jooq-to-use-arrays-in-the-in-clause/43102102 A jOOQ user was wondering why jOOQ would generate an IN list for a predicate like this: Java SQL … when in fact there could have been the following predicate being generated, instead: In the second case, there would have been only one single bind variable instead of 4, a...

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 1 month ago

New blog articles detected

  • How to Benchmark Alternative SQL Queries to Find the Fastest Query

    Tuning SQL isn’t always easy, and it takes a lot of practice to recognise how any given query can be optimised. One of the most important slides of my SQL training is the one summarising “how to be fast”: Some of these bullets were already covered on this blog. For instance avoiding needless, mandatory work,…Read more How to Benchmark Alternative SQL Queries to Find the Fastest Query

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 2 months ago

New blog articles detected

  • The Open-Closed Principle is Often Not What You Think it Is

    jOOQ is a library that loves making everything internal final and package private. We have tons of classes like these: The class implements the semantics of SQL string concatenation. Clearly, you shouldn’t need to tamper with it (or even know about it), because it is “protected” behind the corresponding public API in the DSL class:…Read more The Open-Closed Principle is Often Not What You Think it...

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 2 months ago

New blog articles detected

  • Creating Tables Dum and Dee in PostgreSQL

    I was nerd-sniped: @lukaseder @danieldietrich @odersky why can't I represent table dee and table dum in SQL then? ¬_¬ — Benji Weber (@benjiweber) March 17, 2017 So tables dee and dum are two theoretical tables in SQL, and they can be characterised as such: [Dee] is the relation that has no attributes and a single…Read more Creating Tables Dum and Dee in PostgreSQL

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 2 months ago

New blog articles detected

  • A Nice API Design Gem: Strategy Pattern With Lambdas

    With Java 8 lambdas being available to us as a programming tool, there is a “new” and elegant way of constructing objects. I put “new” in quotes, because it’s not new. It used to be called the strategy pattern, but as I’ve written on this blog before, many GoF patterns will no longer be implemented…Read more A Nice API Design Gem: Strategy Pattern With Lambdas

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 2 months ago

New blog articles detected

  • Faster SQL Through Occasionally Choosing Natural Keys Over Surrogate Keys

    There are many many opinions out there regarding the old surrogate key vs. natural key debate. Most of the times, surrogate keys (e.g. sequence generated IDs) win because they’re much easier to design: They’re easy to keep consistent across a schema (e.g. every table has an ID column, and that’s always the primary key) They’re…Read more Faster SQL Through Occasionally Choosing Natural Keys Over Su...

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 2 months ago

New blog articles detected

  • Many SQL Performance Problems Stem from “Unnecessary, Mandatory Work”

    Probably the most impactful thing you could learn about when writing efficient SQL is indexing. A very close runner-up, however, is the fact that a lot of SQL clients demand tons of “unnecessary, mandatory work” from the database. Repeat this after me: Unnecessary, Mandatory Work What is “unnecessary, mandatory work”? It’s two things (duh): Unnecessary…Read more Many SQL Performance Problems Stem ...

  • Impress Your Coworkers With the Incredible NATURAL FULL OUTER JOIN!

    There are already only very few real-world use-cases for FULL [ OUTER ] JOIN, but maybe, you have run into this beast in the past. But when was the last time you’ve seen a NATURAL JOIN? Right. A quick reminder from our article about JOINs: FULL JOIN A FULL JOIN is a type of OUTER…Read more Impress Your Coworkers With the Incredible NATURAL FULL OUTER JOIN!

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 2 months ago

New blog articles detected

  • jOOQ Tuesdays: Brett Wooldridge Shows What it Takes to Write the Fastest Java Connection Pool

    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…Read more jOOQ Tuesdays: Brett Wooldridge Shows What it Takes to Write the Faste...

  • Should I Implement the Arcane Iterator.remove() Method? Yes You (Probably) Should

    An interesting question was asked on reddit’s /r/java recently: Should Iterators be used to modify a custom Collection? Paraphrasing the question: The author wondered whether a custom java.util.Iterator that is returned from a mutable Collection.iterator() method should implement the weird Iterator.remove() method. A totally understandable question. What does Iterator.remove() do? Few people ever ...

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 3 months ago

New blog articles detected

  • Beautiful SQL: Lateral Unnesting of Array Columns

    Sometimes, SQL can just be so beautiful. One of the less mainstream features in SQL is the array type (or nested collections). In fact, it’s so not mainstream that only 2 major databases actually support it: Oracle and PostgreSQL (and HSQLDB and H2 in the Java ecosystem). In PostgreSQL, you can write: Or in Oracle:…Read more Beautiful SQL: Lateral Unnesting of Array Columns

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 3 months ago

New blog articles detected

  • How to Fetch Oracle 12c Implicit Cursors with JDBC and jOOQ

    Earlier this week, I’ve blogged about how to execute SQL batches with JDBC and jOOQ. This was useful for the MySQL, SQL Server, and Sybase users among you. Today, we’ll discuss a slightly more difficult task, how to fetch Oracle 12c implicit cursors – which are essentially the same thing. What’s an implicit cursor? Oracle…Read more How to Fetch Oracle 12c Implicit Cursors with JDBC and jOOQ

  • How to Execute SQL Batches With JDBC and jOOQ

    Some databases (in particular MySQL and T-SQL databases like SQL Server and Sybase) support a very nice feature: They allow for running a “batch” of statements in a single statement. For instance, in SQL Server, you can do something like this: This is a batch of 4 statements, and it can be executed as a…Read more How to Execute SQL Batches With JDBC and jOOQ

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 3 months ago

New blog articles detected

  • Does Your Database Really Use Your Index?

    Adding the right index to speed up your queries is essential. But after a while, as your system grows, you may find yourself with tons of indexes, which all slow down writing to the database – as with each write to the table, the index needs to be updated as well in the same transaction.…Read more Does Your Database Really Use Your Index?

  • Why You Should Design Your Database to Optimise for Statistics

    In my SQL Masterclass, I frequently remind participants of the fact how important statistics are for a modern cost based optimiser. For instance, if you consider the fact that in an average E-Banking system’s bookings table, you will probably have a transaction amount histogram like the following: In other words, most of your transactions are…Read more Why You Should Design Your Database to Optimi...

  • How to Emulate Partial Indexes in Oracle

    A very interesting feature of the SQL Server and PostgreSQL databases (and some others, including SQLite) is the partial index (sometimes also called “filtered index”). That’s an index that contains only “parts” of the table data. For instance, we can write the following index in SQL Server and PostgreSQL: Let’s imagine you have a house…Read more How to Emulate Partial Indexes in Oracle

  • A Functional Programming Approach to Dynamic SQL with jOOQ

    Typesafe embedded DSLs like jOOQ are extremely powerful for dynamic SQL, because the query you’re constructing with the jOOQ DSL is a dynamic query by nature. You’re constructing a query expression tree using a convenient API (the “DSL”), even if you think your SQL statement is static. For instance: The above query looks like a…Read more A Functional Programming Approach to Dynamic SQL with jOOQ

  • A Probably Incomplete, Comprehensive Guide to the Many Different Ways to JOIN Tables in SQL

    Perhaps the most powerful SQL feature is the JOIN operation. It is the envy of all non-relational databases, because the concept is so simple, yet so universally applicable, when you want to “combine” two data sets. Put simply, when joining two tables, you’re combining every row from one table with every row from another table,…Read more A Probably Incomplete, Comprehensive Guide to the Many Diffe...

  • jOOQ 3.10 will Support SQL Server’s Table Valued Parameters

    SQL Server has this nice feature called table-valued parameters (TVP), where users can pass table variables to a stored procedure for bulk data processing. This is particularly nice when the stored procedure is an inline table valued function, i.e. a function that returns a table as well. For instance: The above function creates a cross…Read more jOOQ 3.10 will Support SQL Server’s Table Valued Pa...

  • How to Write a Quick and Dirty Converter in jOOQ

    One of jOOQ‘s most powerful features is the capability of introducing custom data types, pretending the database actually understands them. For instance, when working with SQL TIMESTAMP types, users mostly want to use the new JSR-310 LocalDateTime, rather than the JDBC java.sql.Timestamp type. In jOOQ 3.9+, this is a no brainer, as we’ve finally introduced…Read more How to Write a Quick and Dirty ...

  • How to Prevent JDBC Resource Leaks with JDBC and with jOOQ

    In a recent consulting gig, I was analysing a client’s connection pool issue in a productive system, where during some peak loads, all the Java processes involving database interactions just started queueing up until nothing really worked anymore. No exceptions, though, and when the peak load was gone in the evening, everything returned back to…Read more How to Prevent JDBC Resource Leaks with JDB...

  • 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…Read more jOOQ Tuesdays: Mario Fusco Talks About Functional and Declarative Prog...

  • What we Need is Standardised Non-OSS Licenses

    If you’ve followed the recent (fake) news, you’ve probably already heard it. Oracle is “massively ramping up audits of Java customers it claims are in breach of its licences” After a quick check on the source (The Register), here’s a more realistic, probably more accurate version of that headline: Oracle is thinking about auditing 1-2…Read more What we Need is Standardised Non-OSS Licenses

  • Do You Really Have to Name Everything in Software?

    This is one of software engineering’s oldest battles. No, I’m not talking about where to put curly braces, or whether to use tabs or spaces. I mean the eternal battle between nominal typing and structural typing. This article is inspired by a very vocal blogger who eloquently reminds us to … […] Please Avoid Functional…Read more Do You Really Have to Name Everything in Software?

  • SQL, Streams, For Comprehension… It’s All the Same

    Recently, at Devoxx, I’ve seen this beautiful slide in a talk by Kevlin Henney Absolutely beautiful! #Devoxx // @KevlinHenney pic.twitter.com/FRndrwxCnU — Lukas Eder (@lukaseder) November 10, 2016 In his talk, he was displaying a variety of approaches to solve the FizzBuzz “problem”, including a couple of very elegant solutions in completely declarative approaches and languages.…Read more SQL, Str...

  • A Beginner’s Guide to the True Order of SQL Operations

    The SQL language is very intuitive. Until it isn’t. Over the years, a lot of people have criticised the SQL language for a variety of reasons. For instance: IDEs cannot easily guess what auto completion options to offer, because as long as you don’t specify the FROM clause, there are no tables in scope (yet):…Read more A Beginner’s Guide to the True Order of SQL Operations

  • Prevent SQL Injection with SQL Builders Like jOOQ

    As long as we allow ourselves to write string-based dynamic SQL embedded in other programming languages like Java, we will have a certain risk of being vulnerable to SQL injection. That’s a fact. Don’t believe it? Check out this website exposing all vulnerabilities on Stack Overflow for PHP questions: https://laurent22.github.io/so-injections In a previous blog post,…Read more Prevent SQL Injectio...

  • The Java Ecosystem’s Obsession with NonNull Annotations

    I’m not well known for my love of annotations. While I do recognise that they can serve a very limited purpose in some areas (e.g. hinting stuff to the compiler or extending the language where we don’t want new keywords), I certainly don’t think they were ever meant to be used for API design. “unfortunately”…Read more The Java Ecosystem’s Obsession with NonNull Annotations

  • Use jOOQ to Read / Write Oracle PL/SQL RECORD Types

    Some of the biggest limitations when working with Oracle PL/SQL from Java is the lack of support for a variety of PL/SQL features through the JDBC interface. This lack of support is actually not limited to JDBC, but also extends to Oracle SQL. For instance, if you’re using the useful PL/SQL BOOLEAN type as such:…Read more Use jOOQ to Read / Write Oracle PL/SQL RECORD Types

  • Applying Queueing Theory to Dynamic Connection Pool Sizing with FlexyPool

    I’m very happy to have another interesting blog post by Vlad Mihalcea on the jOOQ blog, this time about his Open Source library flexypool. Read his previous jOOQ Tuesdays post on Hibernate here. Vlad is a Hibernate developer advocate and he’s the author of the popular book High Performance Java Persistence, and he knows 1-2…Read more Applying Queueing Theory to Dynamic Connection Pool Sizing with ...

  • Why You Should (Sometimes) Avoid Expressions in SQL Predicates

    I’ve recently discovered a rather significant performance issue on a productive Oracle 11g customer database. And I’m sure you have this issue too, which is why I’m documenting it here. This is a simplified representation of the setup at the customer site: ID PAYMENT_DATE TEXT ---------- ------------ ----------------------------------- 33803 21.05.16 DcTNBOrkQIgMtbietUWOsSFNMIqGLlDw... 29505 09.03...

  • A Little Known SQL Feature: Use Logical Windowing to Aggregate Sliding Ranges

    I’m frequently telling developers to put window functions almost everywhere, because they’re so awesome! One feature that I rarely see in the wild (even if it is extremely useful for reporting) is called “logical windowing” in Oracle, and it’s most useful when used with INTERVAL ranges. Let’s see what we may want to do. I…Read more A Little Known SQL Feature: Use Logical Windowing to Aggregate Sli...

  • Don’t Even use COUNT(*) For Primary Key Existence Checks

    In a recent blog post, I’ve advocated against the use of COUNT(*) in SQL, when a simple EXISTS() would suffice. This is important stuff. I keep tuning productive queries where a customer runs a COUNT(*) query like so: … where after they discard the exact count to only check for existence: It doesn’t matter if…Read more Don’t Even use COUNT(*) For Primary Key Existence Checks

  • How to Quickly Rename all Primary Keys in Oracle

    Are you working with someone else’s schema and they haven’t declared nice names for all their constraints? Unfortunately, it is all too easy to create a table like this: Or like this: Sure, you get a little convenience when writing the table. But from now on, you’re stuck with weird, system generated names both for…Read more How to Quickly Rename all Primary Keys in Oracle

  • Be Careful When Emulating Parameterised Views with SYS_CONTEXT in Oracle

    Everyone who writes complex SQL (or dare I say, move business logic into the database?) wishes for parameterised views from time to time. This hypothetical syntax would be terrific: Or as user-defined functions if you insist (as available in SQL Server): As always on this blog, I’m using the useful Sakila database for examples. The…Read more Be Careful When Emulating Parameterised Views with SYS_C...

  • jOOQ Tuesdays: Daniel Dietrich Explains the Benefits of Object-Functional 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…Read more jOOQ Tuesdays: Daniel Dietrich Explains the Benefits of Object-Functio...

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 7 months ago

New blog articles detected

  • When to Choose SQL and When to Choose NoSQL

    Some people make architecture decisions purely based on the loudest consultant: @xeraa @lukaseder no, we base all our important architectural decisions on # of tweets. It's a Twitter Oriented Architecture

  • A Hidden jOOQ Gem: Foreach Loop Over ResultQuery

    A recent question on Stack Overflow about jOOQ caught my attention. The question essentially asked: Why do both of these loops work? And indeed, just like in PL/SQL, you can use any jOOQ ResultQuery as a Java 5 Iterable, because that’s what it is. An Iterable<R> where R extends Record. The semantics is simple. When…Read more A Hidden jOOQ Gem: Foreach Loop Over ResultQuery

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 8 months ago

New blog articles detected

  • Avoid Using COUNT() in SQL When You Could Use EXISTS()

    A while ago, I blogged about the importance of avoiding unnecessary COUNT(*) queries: SQL Tip of the Day: Be Wary of SELECT COUNT(*) … and how to replace them with equivalent EXISTS queries As I’m updating the jOOQ SQL Masterclass to show also PostgreSQL performance characteristics in addition to Oracle, I really have to reiterate this…Read more Avoid Using COUNT() in SQL When You Could Use EXISTS...

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 8 months ago

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 9 months ago

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 9 months ago

New blog posts detected

Out-Market Your Competitors?

Get complete competitive insights on over 2.2 million companies to drive your marketing strategy.

Create Free Account Log in

Out-Market Your Competitors

Get complete competitive insights on over 2.2 million companies to drive your marketing strategy.

Create Free Account

Already a user?  Log in