Java Object Oriented Querying

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 1 day 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 1 week 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 2 weeks 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 weeks 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 4 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 5 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 5 months ago

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 6 months ago

Java Object Oriented Querying

Category: Content
Type: Blog Article

Generated 6 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