The many-to-one fields are defined by the tag <many-to-one> :
<entity name="Contact">
...
</entity>
<entity name="Order">
...
<many-to-one name="contact" ref="Contact"/>
</entity>
In this case, the object contact has an n: 1 relationship with an object Order . This relationship is unidirectional.
The entity Order contains a reference to Contact :
public class Order extends AuditableModel {
...
@ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
private Contact customer;
public Contact getCustomer() {
return customer;
}
public void setCustomer(Contact customer) {
this.customer = customer;
}
...
}