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.
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.
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, de default FlushMode.AUTO is used which, as explained in this article, does not trigger a Persistence Context flush prior to executing a native SQL query.
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.
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.
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.
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.
Introduction A very useful, yet lesser-known, Hibernate feature is the ability to intercept and modify any auto-generated SQL statement using the Hibernate StatementInspector utility. In this article, we are going to see how the Hibernate StatementInspector mechanism works.
Introduction Recently, I noticed the hibernate.query.fail_on_pagination_over_collection_fetch configuration property that was introduced in Hibernate 5.2, and I had absolutely no idea it can be used to prevent the HHH000104 Hibernate issues. As previously explained, if you want to overcome the “HHH000104: firstResult/maxResults specified with collection fetch; applying in memory!” issue, you have to either use 2 queries or a window function to fetch and limit the number of parent records while making sure you always fetch all their associated child entities. Even if the HHH000104 issue is logged as a warning message, it… Read More
Introduction In this article, you are going to learn why using EXTRA Lazy Collections with Hibernate is a bad idea since it can lead to N+1 query issues and cause performance problems. The reason I wanted to write this article is that I keep seeing it mentioned in StackOverflow or the Hibernate forum.