O'Reilly logo

Spring Persistence with Hibernate by Ahmad Seddighi

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

Mapping collections

When a class has a property of type java.util.Collection, or any of its subclasses, there is certainly a one-to-many or many-to-many relationship between the class and the collection's elements. The collection may contain objects of either value type or entity type. Regardless of the object type the collection maintains, we always need an extra table to store the collection elements. Obviously, this table must include a primary key column if the collection maintains entity types.

Java provides different collection types, all represented as subinterfaces or implementations of java.util.Collection. Additionally, Java provides maps, represented by implementations and subinterfaces of the java.util.Map interface. The Map interface ...

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