Vlad Mihalcea

How to call SQL Server stored procedures and functions with JPA and Hibernate

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

Imagine having a tool that could automatically detect performance issues in your JPA and Hibernate data access layer long before pushing a problematic change into production!

With the widespread adoption of AI agents generating code in a heartbeat, having such a tool that can watch your back and prevent performance issues during development, long before they affect production systems, can save your company a lot of money and make you a hero!

Hypersistence Optimizer is that tool, and it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.

So, rather than allowing performance issues to annoy your customers, you are better off preventing those issues using Hypersistence Optimizer and enjoying spending your time on the things that you love!

Introduction

This article is part of a series of posts related to calling various relational database systems stored procedures and database functions from Hibernate. The reason for writing this down is because there are many peculiarities related to the underlying JDBC driver support and not every JPA or Hibernate feature is supported on every relational database.

Read More

Impressions from Devoxx France 2016

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

Imagine having a tool that could automatically detect performance issues in your JPA and Hibernate data access layer long before pushing a problematic change into production!

With the widespread adoption of AI agents generating code in a heartbeat, having such a tool that can watch your back and prevent performance issues during development, long before they affect production systems, can save your company a lot of money and make you a hero!

Hypersistence Optimizer is that tool, and it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.

So, rather than allowing performance issues to annoy your customers, you are better off preventing those issues using Hypersistence Optimizer and enjoying spending your time on the things that you love!

Devoxx France 2016

I’ve just got back from Devoxx France, and I’m happy I got the chance to participate in such an event. The conference was really big (around 2500 participants) with many speakers from all around the world.

It’s all about the people

The best thing about going to a conference is the chance of meeting in person so many people that I only knew them from reading their blogs, using their frameworks, or from Twitter. I met Emmanuel Bernard, whose talks managed to fill in a whole amphitheater:

I got the chance to meet the organizers: Nicolas Martignole, Antonio Goncalves, Arnaud Héritier, and watch a live episode of Les Cast Codeurs.

By far the most entertaining presentation was Ten SQL tricks that you didn’t think they were possible by Lukas Eder, which was both interesting and funny.

I met Ludovic Orban who is the creator of the Bitronix Transaction Manager, a tool that I’ve been using extensively for a long time now.

Since I’ve been fascinated by the StackOverflow architecture, I couldn’t miss Oded Coster‘s presentation and managed to steal some high-performance tuning tips from him as well.

All in all, this was a great event.

The slides

My High-Performance Hibernate talk is very much inspired by the second part of my book. Enjoy watching it!

Transactions and Concurrency Control eBook

How to run database integration tests 20 times faster

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

Imagine having a tool that could automatically detect performance issues in your JPA and Hibernate data access layer long before pushing a problematic change into production!

With the widespread adoption of AI agents generating code in a heartbeat, having such a tool that can watch your back and prevent performance issues during development, long before they affect production systems, can save your company a lot of money and make you a hero!

Hypersistence Optimizer is that tool, and it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.

So, rather than allowing performance issues to annoy your customers, you are better off preventing those issues using Hypersistence Optimizer and enjoying spending your time on the things that you love!

Introduction

In-memory databases such as H2, HSQLDB, and Derby are great to speed up integration tests. Although most database queries can be run against these in-memory databases, many enterprise systems make use of complex native queries which can only be tested against an actual production-like relational database.

In this post, I’m going to show you how you can run PostgreSQL and MySQL integration tests almost as fast as any in-memory database.

Read More

High-Performance Java Persistence – Chapter 15 – Fetching

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

Imagine having a tool that could automatically detect performance issues in your JPA and Hibernate data access layer long before pushing a problematic change into production!

With the widespread adoption of AI agents generating code in a heartbeat, having such a tool that can watch your back and prevent performance issues during development, long before they affect production systems, can save your company a lot of money and make you a hero!

Hypersistence Optimizer is that tool, and it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.

So, rather than allowing performance issues to annoy your customers, you are better off preventing those issues using Hypersistence Optimizer and enjoying spending your time on the things that you love!

Part 2, Chapter 15

Every new chapter of my book is released right after it’s being completed, so the reader doesn’t have to wait for the whole part to be finished to get access to new material.

Table of content

This chapter explains how fetching works in Hibernate.

15. Fetching              
15.1 DTO projection          
15.1.1 DTO projection pagination         
15.1.2 Native query DTO projection       
15.2 Query fetch size           
15.3 Fetching entities          
15.3.1 Direct fetching          
15.3.1.1 Fetching a Proxy reference      
15.3.1.2 Natural identifier fetching        
15.3.2 Query fetching           
15.3.3 Fetching associations          
15.3.3.1 FetchType.EAGER           
15.3.3.2 FetchType.LAZY         
15.3.3.2.1 The N+1 query problem         
15.3.3.2.2 How to catch N+1 query problems during testing  
15.3.3.2.3 LazyInitializationException      
15.3.3.2.4 The Open Session in View Anti-Pattern     
15.3.3.2.5 Temporary Session Lazy Loading Anti-Pattern  
15.3.3.3 Associations and pagination        
15.4 Query plan cache           

Read More

How to call Oracle stored procedures and functions with JPA and Hibernate

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

Imagine having a tool that could automatically detect performance issues in your JPA and Hibernate data access layer long before pushing a problematic change into production!

With the widespread adoption of AI agents generating code in a heartbeat, having such a tool that can watch your back and prevent performance issues during development, long before they affect production systems, can save your company a lot of money and make you a hero!

Hypersistence Optimizer is that tool, and it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.

So, rather than allowing performance issues to annoy your customers, you are better off preventing those issues using Hypersistence Optimizer and enjoying spending your time on the things that you love!

Introduction

This article is part of a series of posts related to calling various relational database systems stored procedures and database functions from Hibernate. The reason for writing this down is because there are many peculiarities related to the underlying JDBC driver support and not every JPA or Hibernate feature is supported on every relational database.

Read More

Impressions from Voxxed Days Bucharest 2016

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

Imagine having a tool that could automatically detect performance issues in your JPA and Hibernate data access layer long before pushing a problematic change into production!

With the widespread adoption of AI agents generating code in a heartbeat, having such a tool that can watch your back and prevent performance issues during development, long before they affect production systems, can save your company a lot of money and make you a hero!

Hypersistence Optimizer is that tool, and it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.

So, rather than allowing performance issues to annoy your customers, you are better off preventing those issues using Hypersistence Optimizer and enjoying spending your time on the things that you love!

Voxxed Days came to Bucharest

Romania has around 70 000 IT professionals, so it was about time we got an event such as Voxxed Days Bucharest. If I am to choose a single word to describe this conference, then I’d go for passion. Without Andra and Alex Proca putting all the energy into this, we wouldn’t have had the opportunity to meet so many passionate developers.

I like conferences like Voxxed because they are targeted to local communities, and there was a fair number of Romanian and international speakers. Having Romanian speakers on stage (Eugen Paraschiv, Robert Munteanu, etc) can be an inspiration for other passionate developers that want to share their knowledge and skills.

I got the chance to meet Stephan Janssen and Mark Hazell who are the founders of Voxxed Days, Galder Zamarreño from Infinispan, Menno and Mihaela from bol.com, and many more.

The most entertaining presentation was given by Josh Long. There were so many people interested in his talk that we had to leave the doors open so that the ones who didn’t get a seat can watch his talk from the hallway.

My talk was about High-Performance JDBC, and I was impressed to see so many people interested in this topic.

Corneliu Creanga pointed out that MySQL can prefetch result-sets even when streaming data.

Thank you all for attending my talk, and I’m looking forward to seeing you next time, and you can also watch the High-Performance JDBC slides on Slideshare.

Transactions and Concurrency Control eBook

How to combine the Hibernate assigned generator with a sequence or an identity column

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

Imagine having a tool that could automatically detect performance issues in your JPA and Hibernate data access layer long before pushing a problematic change into production!

With the widespread adoption of AI agents generating code in a heartbeat, having such a tool that can watch your back and prevent performance issues during development, long before they affect production systems, can save your company a lot of money and make you a hero!

Hypersistence Optimizer is that tool, and it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.

So, rather than allowing performance issues to annoy your customers, you are better off preventing those issues using Hypersistence Optimizer and enjoying spending your time on the things that you love!

Introduction

The entity identifier can either be manually assigned, or it can be automatically generated by an identity column or a database sequence.

In this post, I’ll show you how you can mix the assigned generator with an identity column or a database sequence.

Read More

High-Performance Java Persistence – Chapter 14 – Batching

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

Imagine having a tool that could automatically detect performance issues in your JPA and Hibernate data access layer long before pushing a problematic change into production!

With the widespread adoption of AI agents generating code in a heartbeat, having such a tool that can watch your back and prevent performance issues during development, long before they affect production systems, can save your company a lot of money and make you a hero!

Hypersistence Optimizer is that tool, and it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.

So, rather than allowing performance issues to annoy your customers, you are better off preventing those issues using Hypersistence Optimizer and enjoying spending your time on the things that you love!

Part 2, Chapter 14

Every new chapter of my book is released right after it’s being completed, so the reader doesn’t have to wait for the whole part to be finished to get access to new material.

Table of content

This chapter explains how batch updates work in Hibernate.

14. Batching
14.1 Batching insert statements
14.2 Batching update statements
14.3 Batching delete statements

Read More

MySQL metadata locking and database transaction ending

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

Imagine having a tool that could automatically detect performance issues in your JPA and Hibernate data access layer long before pushing a problematic change into production!

With the widespread adoption of AI agents generating code in a heartbeat, having such a tool that can watch your back and prevent performance issues during development, long before they affect production systems, can save your company a lot of money and make you a hero!

Hypersistence Optimizer is that tool, and it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.

So, rather than allowing performance issues to annoy your customers, you are better off preventing those issues using Hypersistence Optimizer and enjoying spending your time on the things that you love!

Introduction

As previously explained, every SQL statement must be executed in the context of a database transaction. For modifying statements (e.g. INSERT, UPDATE, DELETE), row-level locks must be taken to ensure recoverability and avoid the data anomalies.

Next, I’ll demonstrate what can happen when a database transaction is not properly ended.

Read More

High-Performance Java Persistence – Chapter 13 – Flushing

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

Imagine having a tool that could automatically detect performance issues in your JPA and Hibernate data access layer long before pushing a problematic change into production!

With the widespread adoption of AI agents generating code in a heartbeat, having such a tool that can watch your back and prevent performance issues during development, long before they affect production systems, can save your company a lot of money and make you a hero!

Hypersistence Optimizer is that tool, and it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.

So, rather than allowing performance issues to annoy your customers, you are better off preventing those issues using Hypersistence Optimizer and enjoying spending your time on the things that you love!

Part 2, Chapter 13

Every new chapter of my book is released right after it’s being completed, so the reader doesn’t have to wait for the whole part to be finished to get access to new material.

Table of content

This chapter explains the inner-workings of the Hibernate Persistence Context implementation.

13. Flushing 
13.1 Flush modes
13.2 Events and the action queue
13.2.1 Flush operation order
13.3 Dirty Checking 
13.3.1 The default dirty checking mechanism 
13.3.1.1 Controlling the Persistence Context size 
13.3.2 Bytecode enhancement 

Read More