HHH-11891 - Clarify documentation about Hibernate support for basic array types

Apply Steve suggestions
This commit is contained in:
Vlad Mihalcea 2017-07-28 08:22:35 +03:00
parent f0ccd7126a
commit fa81aafb28
1 changed files with 6 additions and 3 deletions

View File

@ -744,11 +744,14 @@ include::{extrasdir}/collections-map-bidirectional-example.sql[]
[[collections-array]] [[collections-array]]
==== Arrays ==== Arrays
When it comes to arrays, there is quite a difference between Java arrays and relational database array types (e.g. VARRAY, ARRAY). When discussing arrays, it is important to understand the distinction between SQL array types and Java arrays that are mapped as part of the application's domain model.
First, not all database systems implement the SQL-99 ARRAY type, and, for this reason, Hibernate doesn't support native database array types. Not all databases implement the SQL-99 ARRAY type and, for this reason,
Hibernate doesn't support native database array types.
Second, Java arrays could be relevant only for basic types since storing multiple embeddables or entities should always be done using the Java Collection API. Hibernate does support the mapping of arrays in the Java domain model - conceptually the same as mapping a List.
However, it is important to realize that it is impossible for Hibernate to offer lazy-loading for arrays of entities and, for this reason,
it is strongly recommended to map a "collection" of entities using a List rather than an array.
[[collections-array-binary]] [[collections-array-binary]]
==== Arrays as binary ==== Arrays as binary