@Target(value={METHOD,FIELD}) @Retention(value=RUNTIME) public @interface ManyToOne
Example: @ManyToOne(optional=false) @JoinColumn(name="CUST_ID", nullable=false, updatable=false) public Customer getCustomer() { return customer; }
Modifier and Type | Optional Element and Description |
---|---|
CascadeType[] |
cascade
(Optional) The operations that must be cascaded to
the target of the association.
|
FetchType |
fetch
(Optional) Whether the association should be lazily
loaded or must be eagerly fetched.
|
boolean |
optional
(Optional) Whether the association is optional.
|
Class |
targetEntity
(Optional) The entity class that is the target of
the association.
|
public abstract Class targetEntity
Defaults to the type of the field or property that stores the association.
public abstract CascadeType[] cascade
By default no operations are cascaded.
public abstract FetchType fetch
EAGER
strategy is a requirement on the persistence provider runtime that
the associated entity must be eagerly fetched. The LAZY
strategy is a hint to the persistence provider runtime.Copyright © 2021. All rights reserved.