The @javax.persistence.ManyToOne
annotation
defines a single-valued association to another entity class that has
many-to-one multiplicity. In Naked Objects' terms this is a property
whose return type is another entity. In database terms, this is like a
foreign key. The @ManyToOne
annotation goes in
the "child" entity, specifically on the property that points to the
"parent" entity.
It is not normally necessary to specify the target parent entity explicitly since it can usually be inferred from the type of the object being referenced.
The @ManyToOne
sometimes combines with the
@OneToMany
annotation in the parent entity,
making the association bidirectional. See Section 4.5, “One-to-Many” for more details.