Annotation Interface ElementCollection


@Target({METHOD,FIELD}) @Retention(RUNTIME) public @interface ElementCollection
Declares a collection of instances of a basic type or embeddable class. Must be specified if the collection is to be mapped by means of a collection table.

The CollectionTable annotation specifies a mapping to a database table.

Example:

@Entity
public class Person {
    @Id
    protected String ssn;
    protected String name;
    ...
    @ElementCollection
    protected Set<String> nickNames = new HashSet<>();
    ...
}
Since:
2.0
See Also: