Hibernate Tips: How to delete child entities from a many-to-one association
|

Hibernate Tips: How to delete child entities from a many-to-one association

Hibernate Tips is a series of posts in which I describe a quick and easy solution for common Hibernate questions. If you have a question for a future Hibernate Tip, please leave a comment below. Question: My domain model contains a many-to-one association in which the child entity can’t exist without its parent. Can Hibernate…

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

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

When you model your database, you will most likely define several many-to-one or one-to-many 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…