You define association collection type for one-to-many or many-to-many associations as follows:
- Open the association property sheet and click the Detail tab.
- Specify a Multiplicity on both sides.
- Specify either unidirectional or bi-directional navigability.
- Specify role names if necessary.
- If one role of the association is navigable and the multiplicity is many, you can set the collection container type and batch loading size.
- If you select java.util.List or <none>, it implies that you want to use an array or list-indexed collection type. Then you should define an index column to preserve the objects collection order in the database.
Note: The Java collection container type conditions the Hibernate collection type.
Collection Container Type
|
Hibernate Collection Type
|
<None>
|
array
|
java.util.Collection
|
bag or idbag (many-to-many)
|
java.util.List
|
list
|
java.util.Set
|
set
|