I have a Postgres table with several columns of type numrange
and int4range
.
I want to persist data in it from Java. Currently I have this data in a Java class like this:
class Range<T> {
private Integer minimum;
private Integer maximum;
// more code...
}
I'm using the JDBC Driver and the java.sql.*
and I've tried several things, without success:
pstmt.setObject(7, myObject.price()); // price() returns a Range object
This gives me the following error:
Can't infer the SQL type to use for an instance of com.scmspain.admatching.domain.Range. Use setObject() with an explicit Types value to specify the type to use.
I cannot specify the type, since it does not exist in the java.sql.Types
class.