当jdbc返回值类型对应的java类型是[B,那就表示返回值的类型比较模糊难以区分;
BLOB类型是mysql数据库常用来存储,但是通过getBlob()方法获取值得时候会报错:
错误信息:
java.lang.IllegalArgumentException: Can not set [B field yxm.zyf.love.entity.User.user_certify_pic to com.mysql.jdbc.Blob
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
at java.lang.reflect.Field.set(Field.java:764)
at yxm.zyf.love.utils.JdbcUtils.setValByJavaName(JdbcUtils.java:100)
at yxm.zyf.love.utils.JdbcUtils.main(JdbcUtils.java:76)
name: user_certify_pic java-type: [B column-type: BLOB
实际上 user_certify_pic 对应的java类型并不是Blob的类型,[B 有些参数值可以通过getString来获取,但基本上都能通过流来获取