9 High-Performance Tips when using Oracle with JPA and Hibernate

Introduction In this article, I’m going to show you 9 tips that will help you speed up your Oracle database application when using JPA and Hibernate. To get the most out of the relational database in use, you need to make sure the data access layer resonates with the underlying database system, so, in this article, I’m going to present you several tips that can boost up the performance of your Oracle, JPA and Hibernate applications.

Multidimensional array mapping with JPA and Hibernate

Introduction In this article, I’m going to present the best way to map a Java multidimensional array when using JPA and Hibernate. While one-dimensional array types have long been supported by the Hypersistence Utils open-source project, starting with the 2.9 release, you can now persist multidimensional array entity attributes with JPA and Hibernate.

The best way to use a Hibernate ResultTransformer

Introduction In this article, I’m going to present the best way to use a Hibernate ResultTransformer so that you can customize the result set of a given JPA or Hibernate query. As I already explained, the Hibernate ResultTransformer is a very powerful mechanism, allowing you to customize a JPQL, Criteria API, or native SQL query result set in any possible way.

How to map Oracle JSON columns using JPA and Hibernate

Introduction In this article, we are going to see how to map the Oracle JSON column storage types when using JPA and Hibernate. The Hypersistence Utils project provides a generic JsonType that works with Oracle, SQL Server, PostgreSQL, and MySQL, and it can even use the columnDefinition attribute of the JPA @Column annotation to determine the underlying database column type.

How to write a compact DTO projection query with JPA

Introduction In this article, we are going to see how we can write the best DTO projection JPQL query by omitting the package name when using JPA, Hibernate, and Spring. As I already explained, DTO projections are the most efficient way of fetching data when using JPA and Hibernate.

How to override the default Hibernate Session FlushMode

Introduction In this article, we are going to see how we can override the default FlushMode used by Hibernate. If you bootstrap Hibernate natively, and not as a JPA provider, the default Hibernate FlushMode.AUTO strategy will be used, which, as explained in this article, does not trigger a Persistence Context flush prior to executing a native SQL query.

Query timeout with JPA and Hibernate

Introduction In this article, we are going to see what is the best way to set up the query timeout interval with JPA and Hibernate. Setting the query timeout allows you to cancel slow-running queries that would, otherwise, put pressure on database resources.

A beginner’s guide to JPA and Hibernate query hints

Introduction In this article, we are going to see what JPA query hints are, and get to know all the query hints supported by Hibernate. Understanding the Hibernate query hints is very important when developing a non-trivial enterprise application since they allow you to customize the way queries are executed by Hibernate.

The best way to map an entity version property with JPA and Hibernate

Introduction In this article, we are going to see what is the best way to map the entity version property with JPA and Hibernate. Most often, we overlook the basic entity type mappings, focusing more on associations or querying options. However, basic types can also have a significant impact on application performance, especially if the type in question is used in many entity mappings.

Optimistic locking with JPA and Hibernate

Introduction In this article, we are going to see how optimistic locking version property works when using JPA and Hibernate. Most often, we overlook basic concepts and focus only on more advanced topics such as associations or queries, without realizing that basic mappings can also have a significant impact when it comes to persistence effectiveness and efficiency.