问题描述
- 关于clob插入mysql报如下错误
-
org.springframework.jdbc.UncategorizedSQLException: Hibernate flushing: could not update: [com.zte.ace.po.ApplicationAce#162304]; uncategorized SQLException for SQL [update application_ace set userId=?, usingName=?, version=?, description=?, packageName=?, usingType=?, iconPath=?, siconPath=?, appPath=?, state=?, creater=?, provider=?, CPId=?, createTime=?, checker=?, checkDate=?, updater=?, updateTime=?, fileSize=?, downloadCount=?, supportDevice=?, detail=?, discussCount=?, isAce=?, orderNo=?, refuseContent=?, codePath=?, versionCode=?, isAd=?, recommend=?, os=?, bigClassId=?, del=?, drafts=?, typeId=?, releaseState=?, appImgs=?, ratyNum=?, raty=?, appGuid=?, resolution=?, appType=?, userType=?, publishDate=?, iconType=?, isFullScreen=?, templateId=?, sourcePath=?, sourceFile=?, isEbook=?, ebooklogotype=?, ebookicontype=?, ebookbgtype=?, sbgPath=?, bgPath=?, isCharge=?, price=?, chapter=?, ebookAdv=?, ebookAdvId=?, author=?, copyId=?, admsg=?, chargeid=?, chargekey=?, paycode=?, shotImg=?, umAppKey=?, sourceNum=?, baiduAdv=?, baiduAppsid=?, baiduAppsec=?, srcPrice=?, virDownloadCount=?, MMCharge=?, UniCharge=?, Charge360=?, uniVacName=?, uniVacCode=?, AppPath360=?, UniAppPath=?, vigilantlevel=?, readable=?, useChSearchDirectory=?, isgetscore=?, appStatus=?, hasRdZtehr=?, isWellNo=?, startCover=?, teleCharge=?, telePayID=?, telePaySecret=?, telePayCode=?, teleAppPath=? where id=?]; SQL state [null]; error code [0]; Invalid position in BLOB object set; nested exception is javax.sql.rowset.serial.SerialException: Invalid position in BLOB object set
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.orm.hibernate3.HibernateTransactionManager.convertJdbcAccessException(HibernateTransactionManager.java:801)
at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:787)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:663)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy29.updateAppsObj(Unknown Source)
at com.zte.ace.comic.action.ComicAction.rebuildComic(ComicAction.java:711)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:891)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1293)
at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:117)
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:108)
at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1369)
at ognl.ASTMethod.getValueBody(ASTMethod.java:90)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
at ognl.SimpleNode.getValue(SimpleNode.java:258)
at ognl.Ognl.getValue(Ognl.java:494)
at ognl.Ognl.getValue(Ognl.java:458)
at com.opensymphony.xwork2.ognl.OgnlUtil$2.execute(OgnlUtil.java:309)
at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecute(OgnlUtil.java:340)
at com.opensymphony.xwork2.ognl.OgnlUtil.getValue(OgnlUtil.java:307)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:423)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:287)
at com.zte.ace.interceptor.AutoLoginInter.intercept(AutoLoginInter.java:83)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
Caused by: javax.sql.rowset.serial.SerialException: Invalid position in BLOB object set
at javax.sql.rowset.serial.SerialClob.getSubString(SerialClob.java:255)
at com.mysql.jdbc.PreparedStatement.setClob(PreparedStatement.java:3529)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setClob(DelegatingPreparedStatement.java:183)
at org.hibernate.type.ClobType.set(ClobType.java:73)
at org.hibernate.type.ClobType.nullSafeSet(ClobType.java:141)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2015)
解决方案
已解决,不过还是不知道什么原因
解决方案二:
看不懂。
看下是不是Blob blob = new SerialBlob();如果不是换这个试下
解决方案三:
是无效的Blob对象集的引用导致的。你需要序列化存储的对象,才能用于海伯内特的存储机制。希望能帮到你
解决方案四:
它的意思是你把null添加到某个字段里面,但你在数据库的表里面设计了这个字段不能添加null,通过代码看好像是Blob为空的原因,但你可以先断点,获取这条sql,再直接在客户端里面运行,看看那个字段报错,再到代码里面重点检查这个错误。
时间: 2024-10-09 16:40:48