Java and PostgreSQL Arrays

The question is pretty simple: are there any JDO / JPA / anything else tools for mapping object-to-DBs that can handle PG arrays? Multidimensional arrays? Mostly from strings and integers / lengths.

Second: can it handle hstore column types ?

I am trying to implement something to handle these types in a DataNucleus JDO, but still no result. The most impressive and easy to implement support I've seen so far is SQLAlchemy python.

+6
source share
1 answer

First, SQLAlchemy is awesome ... Everything that others cannot do out of the box works like a charm in this ORM.

The solution you may want includes Hibernate:

mapping the postgres array to hibernate might be interesting for you. Basically, all the suggestions you'll see are related to writing the UserType extension. This also applies to Postgres Enums types (and probably hstore, but this will only be an assumption). An example of this type of userType can be found on the Hibernate forums . This detailed article explains the interface in some detail. After writing UserType, you need to annotate the property , and Hibernate will be able to perform the mapping. In newer versions (I used it with Hibernate 4.x) the interface has changed a bit, but you can’t understand anything.

+2
source

Source: https://habr.com/ru/post/906846/


All Articles