Vlad Mihalcea

How to map SQL Server JSON columns using JPA and Hibernate

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

Introduction

In this article, we are going to see how easy it is to map an SQL Server JSON column when using the Hibernate Types project.

Not only that the hibernate-types project supports JSON column types for PostgreSQL and MySQL and Oracle, but, as you will see in this article, the JsonStringType works just fine when using Microsoft SQL Server.

Read More

JDBC Driver Maven dependency list

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

Introduction

Ever wanted to connect to a relational database using Java and didn’t know which JDBC Driver Maven dependency to use?

If so, this article is surely going to help you from now on.

Read More

Six years of blogging

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

Quality over quantity

I’ve been blogging for six years already, and every year I like to write a report with the achievements I’ve made over the last year.

If you are curious about my previous reports, check out the following list:

Page Views

Six years of blogging page views

In 2019, I got around 10,547 daily page views, meaning that this year, I’ll get over 3.85 million page views. That’s a 22% traffic increase since 2018.

Overall, in these six years of blogging, I got over 8.8 million page views and 4.5 million visitors. Cool, right?

Six years of blogging overall statistics

Read More

How to get the query execution plan on SQL Server

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

Introduction

In this article, we are going to see how we can get the query execution plan when using the SQL Server relational database system.

The execution plan allows you to understand the operations done by the database engine when executing a specific SQL query.

Read More

How to map Oracle JSON columns using JPA and Hibernate

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

Introduction

In this article, we are going to see how to map the Oracle JSON column storage types when using JPA and Hibernate.

My hibernate-types project has long been supporting JSON for PostgreSQL and MySQL. However, while developing my new and awesome SQL Master Class training, I realized that the current implementation does not handle Oracle JSON column types properly.

Luckily, the fix was easy and starting with the 2.7.0 version you can now persist and fetch JSON attributes on Oracle using JPA and Hibernate.

Read More

How to write a compact DTO projection query with JPA

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

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.

Read More

How to get the SQL execution plan on Oracle

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

Introduction

In this article, we are going to see how we can get the SQL execution plan on Oracle.

When tuning performance, the execution plan is indispensable as it allows you to understand the operations done by the database when executing a certain SQL query.

Read More

Mapping PostgreSQL Interval to Java Duration with Hibernate

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

Introduction

In this article, we are going to see how to map the PostgreSQL interval column type to a Java Duration object using Hibernate and the hibernate-types project.

Another very useful feature introduced by the hibernate-types project is that all types extending the ImmutableType can now be treated as standard org.hibernate.type.Type, therefore enabling a much better Hibernate Core API integration.

Read More

How to map multiple JPA entities to one database table with Hibernate

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

Introduction

In this article, we are going to see how we can map multiple JPA entities to one table with Hibernate. Using multiple entities can speed up both read and write operations.

This question has been a recurring theme on StackOverflow, so I decided to explain the advantages of mapping multiple JPA entities to the same database table.

Read More

How to limit the SQL query result set to Top-N rows only

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

Introduction

In this article, we are going to see how we can limit the SQL query result set to the Top-N rows only.

Limiting the SQL result set is very important when the underlying query could end up fetching a very large number of records, which can have a significant impact on application performance.

Read More