FileDocCategorySizeDatePackage
ManyToOne.javaAPI DocGlassfish v2 API3969Fri May 04 22:34:06 BST 2007javax.persistence

ManyToOne

public class ManyToOne
This annotation defines a single-valued association to another entity class that has many-to-one multiplicity. It is not normally necessary to specify the target entity explicitly since it can usually be inferred from the type of the object being referenced.

Example:

@ManyToOne(optional=false)
@JoinColumn(name="CUST_ID", nullable=false, updatable=false)
public Customer getCustomer() { return customer; }
since
Java Persistence 1.0

Fields Summary
Constructors Summary
Methods Summary
javax.persistence.CascadeType[]cascade()
(Optional) The operations that must be cascaded to the target of the association.

By default no operations are cascaded.

javax.persistence.FetchTypefetch()
(Optional) Whether the association should be lazily loaded or must be eagerly fetched. The {@link FetchType#EAGER EAGER} strategy is a requirement on the persistence provider runtime that the associated entity must be eagerly fetched. The {@link FetchType#LAZY LAZY} strategy is a hint to the persistence provider runtime.

booleanoptional()
(Optional) Whether the association is optional. If set to false then a non-null relationship must always exist.

java.lang.ClasstargetEntity()
(Optional) The entity class that is the target of the association.

Defaults to the type of the field or property that stores the association.