Hibernate Tip: How to delete child entities from a many-to-one association
Автор: Thorben Janssen
Загружено: 2017-10-25
Просмотров: 21157
Описание:
Get more recipes like this one in my new book Hibernate Tips: More than 70 solutions to common Hibernate problems: https://goo.gl/XfywNk
For some many-to-one associations, the child entity can’t exist without its parent. A typical example is the OrderItem which can’t exist without the Order. When you remove the association between the OrderItem and the Order, you need to delete that OrderItem entity as well. So, what’s the easiest way to implement that?
The JPA specification provides the orphanRemoval feature for these use cases. When you activate it on the association, Hibernate removes a child entity when you remove its association to the parent entity.
If you like this video, please give me your thumbs up and share it with your friends and co-workers.
Like my channel? Subscribe!
➜ http://bit.ly/2cUsid8
Join the free Member Library:
https://goo.gl/dtyIIC
Read the accompanying post:
https://www.thoughts-on-java.org/hibe...
Want to connect with me?
Blog: http://www.thoughts-on-java.org/
Twitter: / thjanssen123
Facebook: / thoughtsonjava
#Hibernate #JPA #HibernatTips
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: