Annotation Type ElementCollection
Mapping for an owned collection of scalar values.
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionNames the scalar value column in the collection table.Controls relationship initialization.Names the column that holds the owner's id in the collection table.Names the column that stores each element's position, which keys the table together with the owner and keeps a List's order and duplicates.The SQL type of the value column, written intoCREATE TABLEas it is, likeColumn.type-- for exampleLONGTEXT-- and validated against the existing column the same way.
-
Element Details
-
fetch
FetchType fetchControls relationship initialization.- Returns:
- fetch policy; EAGER for to-one and LAZY for collections by default
- Default:
LAZY
-
column
String columnNames the scalar value column in the collection table.- Returns:
- column name; element_value by default
- Default:
"element_value"
-
joinColumn
String joinColumnNames the column that holds the owner's id in the collection table. Empty keepsJoinTable.joinColumnwhen that is set andowner_idotherwise; naming the column in both places is a build error.- Returns:
- owner column name; empty for the default
- Default:
""
-
type
String typeThe SQL type of the value column, written intoCREATE TABLEas it is, likeColumn.type-- for exampleLONGTEXT-- and validated against the existing column the same way.- Returns:
- SQL type; empty for the dialect's type for the element class
- Default:
""
-
positionColumn
String positionColumnNames the column that stores each element's position, which keys the table together with the owner and keeps a List's order and duplicates.
An empty name maps a
Setto a table with no position column, keyed by the owner and the value -- the layout JPA providers create, so a table one of them made can be adopted as it is. Such a Set cannot hold null, and a text value is limited to 255 characters, like any text key.- Returns:
- column name; element_position by default, empty for none
- Default:
"element_position"
-