Relationship management

The relationship between entities can be declared using the following syntax:

relationship <type> {  <from entity>[{<relationship name>[(<display field>)] <validation>*}]   to   <to entity>[{<relationship name>[(<display field>)] <validation>*}]}

The <type> can be OneToMany, ManyToOne, OneToOne, or ManyToMany, and as the name suggests, declares the relationship type between <from entity> and <to entity>.

The <from entity> phrase is the name of the owner entity of the relationship or the source. The <to entity> phrase is the destination of the relationship.

The <relationship name> phrase is optional and can be used to specify the field names to be created for the relationship in the domain object. The <display field>

Get Full Stack Development with JHipster - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.