how to map an array of custom type from postgres to java using hibernate -
i trying map array of custom type returned postgres procedure java
i have custom type in postgres
create type public.customtype_sample as( sampleid bigint, samplename character varying, samplevalue character varying )
the procedure returns array of customtype_sample
column of type customtype_sample[]
in postgres
i went through various link: how map user data type (composite type) hibernate
array usertype in hibernate , postgresql --> mappingexception
and may more wrote class implements array of sampletype end getting exception
"could not execute query"
caused : org.postgresql.util.psqlexception: method org.postgresql.jdbc4.jdbc4array.getarrayimpl(long,int,map) not yet implemented.
the error occurs in nullsafeget method of usertype
@override public object nullsafeget(resultset rs, string[] names, sessionimplementor session, object owner) throws hibernateexception, sqlexception { sampletype[] javaarray = null; array array = (array) rs.getarray(names[0]); if (!rs.wasnull()) { javaarray = (sampletype[]) array.getarray();//error occurs here } return toreferencetype(javaarray); }
seems when trying array of custom type there might problem not able understand how write usertype class array of customtype. appreciated.
had same error, , fixed upgrading postgresql jdbc 9.2-1002-jdbc4 9.4-1201-jdbc41
Comments
Post a Comment