My class
class PgFolder {
long id;
int[] pgFeature;
}
getter...
setter...
My table
CREATE TABLE folder {
ID BIGSERIAL PRIMARY KEY,
feature INT[]
}
My xml
<insert id="insertManyFolder" parameterType="java.util.List">
INSERT INTO
folder
(feature)
VALUES
<foreach collection="list" item="item" index="" separator=",">
(#{item.pgFeature})
</foreach>
</insert>
I want to insert a List<PgFolder> list. There are many PgFolder instance in the list. When I run the program, I got an error:
org.apache.ibatis.exceptions.PersistenceException:
Error updating database. Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property '__frch_item_0.pgFeature'. It was either not specified and/or could not be found for the javaType (java.util.List) : jdbcType (null) combination.
Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property '__frch_item_0.pgFeature'. It was either not specified and/or could not be found for the javaType (java.util.List) : jdbcType (null) combination.**
Why I got this error message? How to insert the array value in the right way? I can insert an array value if I use the sql in postgres client. so the postgres of the version I installed can support the array value.
pgFeaturefromint[]toInteger[]? The solution will be much cleaner if you avoid primitive array.