Java and PostgreSQL Arrays Java and PostgreSQL Arrays database database

Java and PostgreSQL Arrays


First of, SQLAlchemy is awesome... All the stuff that others can't do out-of-the-box works like a charm in this ORM.

The solution that you might want involves Hibernate:

mapping a postgres array with hibernate might be interessting for you. Basically, all the suggestions you will see involve the writing of a UserType extension. This would also apply to Postgres Enums types (and probably hstore, but that would only be a guess). An example for such a userType could be found on the Hibernate forums. This in-depth article explains the interface fairly detailed. After writing the UserType, you only need to annotate the property and Hibernate will be able to do the mapping. In newer versions (I've used it with Hibernate 4.x) the interface has changed slightly, but nothing you can't figure out.