[hibernate-dev] Are arrays of non-basic elements supported?

Gail Badner gbadner at redhat.com
Wed Jul 26 12:32:52 EDT 2017


OK, I'll make sure Hibernate also treats an empty array element as
 equivalent to null as well.

Vlad, thanks for correcting the documentation.

On Wed, Jul 26, 2017 at 7:38 AM, Vlad Mihalcea <mihalcea.vlad at gmail.com>
wrote:

> The docs says:
>
> When it comes to arrays, there is quite a difference between Java arrays
> and relational database array types (e.g. VARRAY, ARRAY). First, not all
> database systems implement the SQL-99 ARRAY type, and, for this reason,
> Hibernate doesn’t support native database array types. Second, Java arrays
> are relevant for basic types only since storing multiple embeddables or
> entities should always be done using the Java Collection API.
>
> I guess the "Second, Java arrays ..." part is indeed a little bit
> misleading.
>
> I created the following issue:
>
> https://hibernate.atlassian.net/browse/HHH-11891
>
> Is it a problem if I link the docs to my blog post about how to support
> arrays of basic types?
>
> https://vladmihalcea.com/2017/06/21/how-to-map-java-and-sql-
> arrays-with-jpa-and-hibernate/
>
> Thanks,
> Vlad
>
> On Wed, Jul 26, 2017 at 4:04 PM, Steve Ebersole <steve at hibernate.org>
> wrote:
>
>> That doc section is wrong.  Vlad - can you fix that
>>
>> We do in fact support arrays of all types including embeddables and
>> entities.  However, we have always recommended to not use arrays for
>> entities as arrays cannot be lazy loaded (not even using bytecode
>> enhancement).
>>
>> On Mon, Jul 24, 2017 at 6:29 PM Gail Badner <gbadner at redhat.com> wrote:
>>
>> > Documentation makes it sound like only arrays of basic types are
>> supported.
>> > [1]
>> >
>> > I see a test using an array of entities, but I don't see one for an
>> array
>> > of embeddables. [2]
>> >
>> > Regards,
>> > Gail
>> >
>> > [1]
>> >
>> > http://docs.jboss.org/hibernate/orm/5.2/userguide/html_
>> single/Hibernate_User_Guide.html#collections-array
>> > [2]
>> >
>> > https://github.com/hibernate/hibernate-orm/blob/master/hiber
>> nate-core/src/test/java/org/hibernate/test/annotations/
>> array/Contest.java#L40-L42
>> > _______________________________________________
>> > hibernate-dev mailing list
>> > hibernate-dev at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>> >
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
>
>


More information about the hibernate-dev mailing list