Arrays datatype support via java.sql.Array

Description

I am working on the issue and have some promising results so far with single-dimensional arrays and no changes to the core. It comes as a new component.

It's nearly ready for submission, but I need to test more data types, and also test it on HyperSQL, which seems to be the only other database that supports them. H2 supports arrays as well, but requires that we use PreparedStatement.setObject, instead of Connection.createArrayOf and PreparedStatement.setArray.

Random-dimensional arrays would require core changes.

Environment

PostgreSQL 9.3
Hibernate 5.2

Activity

Show:
Christian Beikov
September 30, 2016, 8:04 AM

Looks great. I am looking forward to see this merged into the core! Maybe you could also implement some kind of "emulation" for DBs that don't support arrays natively? I was thinking about using XML or JSON types of those DBs as storage types. Especially XML has good support wrt. aggregation and unnesting which is rather important when having arrays.

Йордан Гигов
September 30, 2016, 2:45 PM

Emulation would be easiest with JSON types, however there is no interface to distinguish between printing/reading a type as a JSON string or XML string. StringRepresentableType is too ambiguous in which way it's supposed to be used, and it can't be relied on for either as it's currently implemented.
And there is currently no method of passing persistence-context-specific property values to the type contributor, so controlling that choice through a setting would be impossible while it's a standalone plugin.

However, emulation would imply using `setString`, rather than `setArray` and not using any part of this as it is with the current PR.

I'll post an update to the PR detailing what I think needs more work, so as not to lose track.

Assignee

Unassigned

Reporter

Йордан Гигов

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

Affirmative

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure