Table partitioning with Spring and Hibernate
Introduction In this article, we are going to see how we can implement a table partitioning solution when using Spring and Hibernate. The goal of table partitioning is to split a large table into multiple smaller partition tables so that the associated table and index records can fit into the in-memory Buffer Pool, therefore allowing a more efficient seek or scan.
How to batch INSERT statements with MySQL and Hibernate
Introduction In this article, we are going to see how we can batch INSERT statements when using MySQL and Hibernate. While Hibernate has long supported automated JDBC batch inserts, this feature doesn’t work when using the IDENTITY identifier generator strategy. Unfortunately, MySQL doesn’t support SEQUENCE objects, so using IDENTITY is the only reasonable option. Therefore, I’m going to show you a technique you can use to get Hibernate batch INSERT statements for entities that use the IDENTITY generator.
How to find the source of an SQL query generated by Hibernate
Introduction In this article, we are going to see how we can find the source of an SQL query generated by Hibernate. Knowing where a given SQL query originates from is very useful when trying to investigate performance issues caused by either long-running queries or queries that are executed excessively (e.g., N+1 query issues).
How to fetch multiple JPA collections with Blaze Persistence MULTISET
Introduction In this article, we are going to see how we can fetch multiple JPA entity collections without generating an implicit Cartesian Product with the MULTISET strategy offered by the Blaze Persistence open-source project. The MULTISET fetch strategy is inspired by the MULTISET operator offered by jOOQ. If you are not familiar with the MULTISET operator, then check out this article first, in which I explain why this jOOQ feature is truly revolutionary.
The best way to hide the JPA entity identifier
Introduction In this article, I’m going to show you the best way to hide the JPA entity identifier so that the users of your application won’t be able to guess and access data that belongs to other users. This has been a recurring question that I’ve been getting when running training or workshops, so I decided it’s a good idea to formalize it in an article.
The best way to use JPA bidirectional sync methods
Introduction In this article, we are going to see what are the best way to use JPA bidirectional sync methods for one-to-many, one-to-one, and many-to-many associations. For an introduction to why you need sync methods for your bidirectional JPA associations, check out this article first.