I'm writing a Java application that uses PostgreSQL as its RDBMS back end. I'm using Hibernate to create the DB schema (actually I already created the db schema myself but I got rid of that because I wanted to make sure my app would be able to understand it properly...).
I'd like to use some of Java 8's new types - specifically, the Duration type, and I'd like this to map to a column of type Interval. However, when Hibernate generates my schema it creates the column with type bytea, which is not going to be useful when I try to load in data from CSV files. A column of type interval, on the other hand, is able to read time formats like 01:23:45 from csv files and persist it just fine.
So how can I tell Hibernate that this Java field of type Duration should be mapped to a column of type Interval?
Thanks.
Edit: Note that this is not a question of how do I hook my app up to hibernate and postgresql. I already have it hooked up and configured for the most part. I am asking how to define custom type mappings so that my java Duration gets mapped to a PostgreSQL interval rather than a byeta.