查询数据类型为blob类型 报错

hibernate
新增没有问题 查询报错,
数据库存储为blob类型
实体类:IdCardInfo字段为:private byte[] PHOTOS;//照片
dao:
Session session = null;
List listIdCardInfo = null;
Transaction tx = session.beginTransaction();
SQLQuery query = session.createSQLQuery(sql);
query.setResultTransformer(Transformers.aliasToBean(IdCardInfo.class));
System.out.print( "*****"+query);
listIdCardInfo = query.list();
tx.commit();
return listIdCardInfo;
在listIdCardInfo = query.list();报错
报错信息:
2708850 [SpringJobSchedulerFactoryBean_Worker-10] DEBUG com.mchange.v2.c3p0.impl.NewPooledConnection - com.mchange.v2.c3p0.impl.NewPooledConnection@ca5f99b handling a throwable.
com.ibm.db2.jcc.b.SqlException: BigDecimal conversion exception [ibm][db2][jcc][converters] Overflow occurred during numeric data type conversion of "269647".. See attached Throwable.
at com.ibm.db2.jcc.c.mb.a(mb.java:1827)
at com.ibm.db2.jcc.c.pb.a(pb.java:1098)
at com.ibm.db2.jcc.c.pb.a(pb.java:812)
at com.ibm.db2.jcc.c.pb.a(pb.java:163)
at com.ibm.db2.jcc.c.dc.a(dc.java:266)
at com.ibm.db2.jcc.b.tf.a(tf.java:1682)
at com.ibm.db2.jcc.b.tf.d(tf.java:2103)
at com.ibm.db2.jcc.b.tf.Y(tf.java:540)
at com.ibm.db2.jcc.b.tf.executeUpdate(tf.java:523)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133)
at org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:204)
at org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1313)
at org.hibernate.internal.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:401)
at cn.com.boomhope.face.dao.hibernate.impl.HbFaceWsLogDao.saveFaceWsLog(HbFaceWsLogDao.java:201)
at cn.com.boomhope.face.dao.hibernate.impl.HbFaceWsLogDao.batchAdd(HbFaceWsLogDao.java:44)
at cn.com.boomhope.face.service.impl.HbLogServiceImpl.batchAddFaceWsLog(HbLogServiceImpl.java:139)
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:311)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:113)
at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)

2个回答

如果我没有看错的话, 下面报错的堆栈与你上面给出的代码没有关系.

下面的quartz定时任务报错: at cn.com.boomhope.face.dao.hibernate.impl.HbFaceWsLogDao.saveFaceWsLog(HbFaceWsLogDao.java:201)

diaofeiyang
rfeiyang debug走listIdCardInfo = query.list();就开始报错了。listIdCardInfo 为空
大约 2 年之前 回复
这个BigDecimal呢

com.ibm.db2.jcc.b.SqlException: BigDecimal conversion exception [ibm][db2][jcc][converters] Overflow occurred during numeric data type conversion of "148762".. See attached Throwable.
at com.ibm.db2.jcc.c.mb.a(mb.java:1827)
at com.ibm.db2.jcc.c.pb.a(pb.java:1098)
at com.ibm.db2.jcc.c.pb.a(pb.java:812)
at com.ibm.db2.jcc.c.pb.a(pb.java:163)
at com.ibm.db2.jcc.c.dc.a(dc.java:266)
at com.ibm.db2.jcc.b.tf.a(tf.java:1682)
at com.ibm.db2.jcc.b.tf.d(tf.java:2103)
at com.ibm.db2.jcc.b.tf.d(tf.java:2454)
at com.ibm.db2.jcc.b.tf.Y(tf.java:540)
at com.ibm.db2.jcc.b.tf.executeUpdate(tf.java:523)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133)
at org.hibernate.engine.query.spi.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:204)
at org.hibernate.internal.SessionImpl.executeNativeUpdate(SessionImpl.java:1313)
at org.hibernate.internal.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:401)

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问