ManyToOne
annotationin packageklyn.data.mapping
public annotation ManyToOne(
fetch as FetchType = FetchType.EAGER,
optional as Boolean = true,
cascade as IList<CascadeType> = []
)
ManyToOne

Declares a many-to-one entity relationship.

A many-to-one relationship is eager by default. Set fetch to FetchType.LAZY when the target should be represented as an unloaded relationship until the Entity Engine loads it. When optional is omitted and an SQL @JoinColumn explicitly declares nullable, the relationship adopts that constraint. Explicit contradictory values are rejected during mapping validation.

Example
import klyn.data.mapping
import klyn.data.sql

@ManyToOne(
fetch=FetchType.LAZY,
optional=false,
cascade=[CascadeType.PERSIST, CascadeType.MERGE]
)
@JoinColumn(name="customerId")
public property customer as Customer