@Retention(CLASS) @Target({FIELD})

public @interface ManyToMany

Maps entity collection membership through a join table or an inverse mappedBy field. Owning Lists store occurrences in a list_position column by default, allowing repeated links. OrderColumn can override its name; OrderBy controls load order.

Methods

public abstract FetchType fetch() default FetchType.LAZYControls relationship initialization.
public abstract CascadeType[] cascade() default {}Chooses operations to propagate to related entities.
public abstract String mappedBy() default ""Names the owning Java relationship field on the target entity.

Method details

fetch

public abstract FetchType fetch() default FetchType.LAZY
Controls relationship initialization.

Returns

fetch policy; EAGER for to-one and LAZY for collections by default

cascade

public abstract CascadeType[] cascade() default {}
Chooses operations to propagate to related entities.

Returns

cascade operations; empty by default

mappedBy

public abstract String mappedBy() default ""
Names the owning Java relationship field on the target entity.

Returns

owning field name, or empty for the owning side