Using PostgreSQL range types


#1

I´m wondering how best PostgreSQL range types could be used from Hibernate.

  • As a first step I’m working on a pull request for pgjdbc to support range types.
  • A second step would probably to map to a domain type, I don’t think you want to have database driver types in your entities. Are there any good candidates?
  • A third step would be to support range type operators and functions in HQL. Can this be done? Are there examples or documentation on how to do this?

I am aware of vladmihalcea/hibernate-types.


#2

As a first step, I think we need to have support for this feature in pgjdbc.

Afterward, if these range types are not supported by the vast majority of RDBMS, I doubt these types could be added in hibernate-core. That’s why I added support for JSON and ARRAY in hibernate-types.

With JSON, I think that more and more DBs will support it, so eventually that could be integrated in hibernate-core, but for RANGE types, we need to check all major DBs for that.

A third step would be to support range type operators and functions in HQL. Can this be done? Are there examples or documentation on how to do this?

That might be easier to implement in 6.0. In 5.x, it’s not that easy to extend HQL to support new operators. If those operators are not widely supported, it’s probably better to left them out.