Best Practices for Many-To-One and One-To-Many Association Mappings

preview_player
Показать описание
Today, I want to talk about best practices for many-to-one and one-to-many association mappings.
When you model your database, you will most likely define several of these associations. And it’s, of course, the same when you model your entities. It’s quite easy to do that with JPA and Hibernate. You just need an attribute that represents the association and annotate it with a @ManyToOne or @OneToMany association. But as easy as it seems, there are several pitfalls that you can avoid by following a few best practices.

If you like this video, please give me your thumbs up and share it with your friends and co-workers.

Like my channel? Subscribe!

Join the free Member Library:

Want to connect with me?
Рекомендации по теме
Комментарии
Автор

Hello, thank you for your useful video. I have just one remark/question. You told us to avoid using Cascadetype.REMOVE but in 6:30 you used Cascadetype.ALL (which include REMOVE Cascading) with orphanRemoval. Is it a mistake? Or the fact that there is an orphanRemoval hides the cascading removal? Thanks in advance

hichamlasfar
Автор

Pretty neat explanation. Thanks for your effort create such interactive video... I am curious to read your book :)

ravibeli