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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.