Hibernate Saving Collections (using @ElementCollection)

In this example you will learn how to deal with persisting entities that have members that are collections like lists, and maps. We will use the @ElementCollection annotation. to define the collection of Embeddable objects. As a disclaimer, this is not a typical usage of Embeddable objects as the objects are not embedded in theContinue reading “Hibernate Saving Collections (using @ElementCollection)”

Hibernate One-To-Many Mapping Tutorial

In this example you will learn how to map one-to-many relationship using Hibernate. Consider the following relationship between Student and Phone entity. According to the relationship a student can have any number of phone numbers. The relational model is shown below. To create this relationship you need to have a STUDENT, PHONE and STUDENT_PHONE table.  ToContinue reading “Hibernate One-To-Many Mapping Tutorial”