The awesome BaseJpaRepository from Hypersistence Utils
Introduction In this article, I’m going to explain how you can use the BaseJpaRepository from the Hypersistence Utils OSS project as an alternative to the default Spring Data JpaRepository. The reason why I’m not using the default JpaRepository on any of my Spring projects is that it provides some terrible defaults that can be very easily misused, like: The findAll Anti-Pattern The JPA save Anti-Pattern So, there are two ways you can fix the problems induced by the default JpaRepository: You can use the HibernateRepository to deprecate the questionable methods that you… Read More
The best way to use UNION, INTERSECT, and EXCEPT with Hibernate
Introduction In this article, we are going to see how we can write UNION, INTERSECT, and EXCEPT queries with Hibernate. While you could have always used all these relational set operations using native SQL queries, starting with Hibernate 6, you can use UNION, INTERSECT, and EXCEPT in JPQL and Criteria entity queries. This is all possible because of the new Semantic Query Model that Hibernate has introduced in version 6.
The Spring Data JPA findById Anti-Pattern
Introduction In this article, we are going to see how the Spring Data JPA findById method can become an Anti-Pattern when using it to reference parent entity associations.
Spring Data JPA entity locking
Introduction In this article, we are going to see what options Spring Data JPA offers for entity locking. We will see how we can apply a shared or exclusive row-level lock upon fetching one or multiple entities.
The Spring Data findAll Anti-Pattern
Introduction In this article, we are going to see why inheriting the default Spring Data findAll method in every data access Repository is a terrible Anti-Pattern.