Subscribe on YouTube to not miss any video. Association Mapping Pitfalls The mapping of associations seems easy but there are several pitfalls you should avoid. Articles mentioned in the video: Ultimate Guide – Association Mappings with JPA and Hibernate Entity Mappings: Introduction to JPA FetchTypes Why you should avoid CascadeType.REMOVE for to-many associations and what

Read More

Like most Java developers, you probably use Hibernate directly or via Spring Data JPA to implement your application’s persistence layer. In general, this works very well for most use cases, but it causes some issues if you need to implement a batch job. This is because Hibernate, like most object-relational mapping frameworks, maps each database

Read More

Subscribe on YouTube to not miss any video. Database Migration You have various options to automate the creation and update of your database. You can use JPA’s schema generation feature or use version-based database migration tools, like Flyway and Liquibase. I explained all of them in great detail here on the blog. You can find

Read More

Wow, 2020 has been a wild one. I’m sure all of us could talk for hours about the problems and all the stuff we were unable to do. So, let’s skip that and focus on the good parts. There were quite a few things that went unexpectedly well. I will summarize the most interesting ones

Read More

Disclaimer: This post is sponsored by Cockroach Labs. CockroachDB is an open-source relational database designed to be highly scalable and reliable in distributed environments. It’s available on AWS and Google Cloud or as an on-premise installation. This makes it an interesting candidate for microservice-based applications. If you want to give it a try or if

Read More

When we’re talking about performance optimizations for Spring Data JPA, the handling of associations is always an important topic. Because Spring Data JPA is based on JPA and most often used with Hibernate, you can apply all the performance tuning concepts you can find here on the blog. The most important one is to use

Read More

JPA and Hibernate provide 3 main options to map a Collection. If it’s a Collection of other entities, you can model it as a to-many association. This is the most common mapping. But you can also map it as an @ElementCollection or as a basic type. In this article, I will show you all 3

Read More

When writing tests that rely on a database, you are facing 2 challenges: You need to write meaningful tests that ensure that your application works correctly. You need to provide a test database for each test run. I can’t help you with the 1st challenge. You know your application a lot better than I do,

Read More