Hibernate database catalog multitenancy

Introduction

As I explained in this article, multitenancy is an architectural pattern which allows you to isolate customers even if they are using the same hardware or software components.

There are multiple ways you can achieve multitenancy, and in this article, we are going to see how you can implement a multitenancy architecture using the database catalog as the unit of isolation.

Continue reading “Hibernate database catalog multitenancy”

A beginner’s guide to database multitenancy

Introduction

In software terminology, multitenancy is an architectural pattern which allows you to isolate customers even if they are using the same hardware or software components. Multitenancy has become even more attractive with the widespread adoption of cloud computing.

A relational database system provides a hierarchy structure of objects which, typically, looks like this: catalog -> schema -> table. In this article, we are going to see how we can use each of these database object structures to accommodate a multitenancy architecture.

Continue reading “A beginner’s guide to database multitenancy”

How to query parent rows when all children must match the filtering criteria with SQL and Hibernate

Introduction

The Hibernate forum is a never-ending source of inspiration when it comes to solving real-life problems you might bump into when developing an enterprise application.

For instance, this post asks about a JPQL query which should fetch a given parent entity when all its child entities match the given filtering criteria.

Continue reading “How to query parent rows when all children must match the filtering criteria with SQL and Hibernate”

The best way to use SQL functions in JPQL or Criteria API queries with JPA and Hibernate

Introduction

When executing an entity query (e.g. JPQL, HQL or Criteria API), you can use any SQL function without having to register it as long as the function is passed directly to the WHERE clause of the underlying SQL statement.

However, if the SQL function is used in the SELECT clause, and Hibernate has not registered the SQL function (be it a database-specific or user-defined function), you will have to register the function prior to using it in an entity query.

In this article, you are going to learn various ways to register SQL functions with JPA and Hibernate.

Continue reading “The best way to use SQL functions in JPQL or Criteria API queries with JPA and Hibernate”