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 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 ...

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