O'Reilly logo

Hibernate Recipes: A Problem-Solution Approach by GARY MAK, SRINIVAS GURUZU

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Many-Valued Associations

A many-valued association is by definition a collection of references to entities. The collection can be of type List, Set, Map, and so on in Java.

Why would you have a collection of references? When there is a parent/child relationship, and one parent can be associated to many children, the parent contains a collection of references to the child entities. In the case of a relational model, suppose two tables are dependent on each other, this can be represented as a foreign key column in the dependent table. For one row in the parent table, there exist many rows in the child table.

You've seen this in earlier chapters that specified how to use collections. This chapter discusses one-to-many and many-to-many relationships ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required