35. What are the Collection types in Hibernate

  • Bag
  • List
  • Set
  • Array
  • Map
  • Primitive-Array
All collection mappings, except those with set and bag semantics, need an index column in the collection table. An index column is a column that maps to an array index, or List index, or Map key.

If your table does not have an index column, and you still wish to use
List as the property type, you can map the property as a Hibernate <bag>. A bag does not retain its order when it is retrieved from the database, but it can be optionally sorted or ordered.

No comments:

Post a Comment