Coffee with Thorben 2020-01-29 – Soft Deletes & Bi-directional Association


Take your skills to the next level!

The Persistence Hub is the place to be for every Java developer. It gives you access to all my premium video courses, monthly Java Persistence News, monthly coding problems, and regular expert sessions.


Subscribe on YouTube to not miss any video.

Soft Deletes

During last week’s stream, I was asked to show how to implement soft deletes with Hibernate. So, that will be the topic of this week’s stream.

In addition to the stream, you might find this article useful:
How to implement a soft delete with Hibernate.

Question of the Week

The handling of bidirectional associations defined by the JPA specification seems to be easy and comfortable. But it introduces a few pitfalls that can cause severe problems. A typical example for that is this week’s Question of the Week:

Detached entity passed to persist when mapping existing child entity to new parent entity.

If you want to dive deeper into association management, you can find my best articles about that on this overview page.

And you also might enjoy one of the previous Coffee with Thorben streams: Coffee with Thorben – Association Pitfalls.

This week’s tutorials

Blog

Over the last few weeks, I got several questions about association mappings, the best fetching behavior, and general best practices. Answering them was usually easy because I had already written several articles about these topics.

But it also showed that I was missing a page that pulls all these articles together. So, for this week’s content, I decided to work on that page instead of writing a new article. You can now find my best tutorials about managing associations with JPA and Hibernate here.

YouTube

Spring Data JPA supports various ways to retrieve data from your database. Native queries are the most flexible option. They enable you to use all the features supported by your database and are your best option for very complex use cases.

But all this flexibility comes with a few downsides. Some of Spring Data JPA’s are not available for native queries, and others require a little bit of extra work. I dive into the details of all of this in this week’s video:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.