Chapter 6. Collection Mapping

An object of value type has no database identity, and objects of value type are dependent on the owning entity object. The lifespan of the value type is bound by the lifespan of the owning entity. Entities that have a collection of value types need to be mapped to an appropriate collection interface from the Java API. For entities to have a collection of value types, you need to have a separate table with the entity's primary key as a foreign key.

Hibernate supports most of the collection interfaces provided by Java API. It's recommended that you use the collection interface to declare the type of the property and a matching implementation. Hibernate suggests using interfaces to declare collections because it supports ...

Get Hibernate Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.