The database schema is unchanged from the Many-To-One tutorial, and might look like:
The bean has a students field that returns the students that belong to the house. House annotates
@OneToMany to describe the relationship. The
@JoinColumn is used to specify the foreign key, the field in Student
that is the
A @OneToMany always requires a corresponding @ManyToOne on the target entity.
The Student has a house field annotated a
unchanged from the
The one-to-many relation provides a House the ability to get all of its Students. Resin will perform any necessary database lookup.
The example queries all houses and prints their names and all of their students.