I have a PostgreSQL custom type:
CREATE TYPE seg_type AS
(
_timestamp bigint,
segment_type bigint,
area_type bigint,
);
And I have a java class:
public class Segment
{
private Long ts;
private Long seg_type;
private Long area_type;
}
In addition I have a stored procedure:
CREATE OR REPLACE FUNCTION SomeFunc(seg_type[])
I'm using postgresql-9.3-1102.jdbc41.jar to connect to my DB. And I want to be able to call my stored procedure from the java code with Segment[] like this:
String query = new String("{call SomeFunc(?)}");
CallableStatement stmt = dbConn.prepareCall(query);
stmt.setObject(1, Segment[], Type);
If this is the correct implementation so what should I put in the Type? or maybe the implementation is incorrect?
createArrayand so on), but you'll probably have toimplements PGobjectfor your type and handle the composite field packing/unpacking yourself.