The difference between Spring Data JPA’s findById, getOne, getById, and findOne methods

The difference between Spring Data JPA’s findById, getOne, getById, and findOne methods

Spring Data’s JpaRepository provides a huge set of methods that simplify the implementation of your database operations. You can use them to persist, remove, and read an entity object. Choosing the right method for your use case is one of the few problems these interfaces create. And that’s sometimes not as easy as you might expect. One…

Entity Views with Blaze Persistence – The better DTO projections?

Entity Views with Blaze Persistence – The better DTO projections?

Blaze Persistence’s Entity Views try to solve some of the most common complaints about DTO projections in JPA and Hibernate. Most developers know that DTOs improve the performance of their read operations. But they often avoid using them because it requires boilerplate code and often creates code that’s not easily maintainable. JPA’s DTO support also…

Migrating to Hibernate 6

Migrating to Hibernate 6

Hibernate 6 has been released for a while, and I see more and more teams migrating their persistence layers or at least preparing for the migration. As so often, the work required for the migration to Hibernate 6 depends on your code quality and the Hibernate version you’re currently using. For most applications using Hibernate…

Create better Criteria queries with Blaze persistence

Create better Criteria queries with Blaze persistence

The Blaze Persistence project provides an interesting alternative to JPA’s Criteria API. Both APIs enable you to define queries dynamically at runtime. Most developers use it to create query statements based on user input or the result of a business operation. Unfortunately, JPA’s Criteria API isn’t very popular because it’s hard to read and write….