Hibernate when you save data to an Oracle database, you report the following error:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26-27--28 29---30 31--32 33 34 35 36 37 38-39 40 41 42 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
20:25:56,593 WARN jdbcexceptionreporter:100-sql error:12899, sqlstate:72000 20:25:56,593 Error JDBCExceptionRep orter:101-ora-12899: Column "its". Vio_business_response_i "." RESPONSE value is too large (actual: 521, Max: 20:25:56,593 ) WARN jdbcexceptionreporter:100-sql error:12899, SQLState: 72000 20:25:56,593 ERROR jdbcexceptionreporter:101-ora-12899: Column "its". Vio_business_response_i "." RESPONSE value is too large (actual value: 521, max: 20:25:56,593) ERROR abstractflushingeventlistener:324-could not synchronize da Tabase State and session org.hibernate.QueryTimeoutException:Could not execute JDBC batch update &nbs P;at Org.hibernate.exception.SQLStateConverter.convert (sqlstateconverter.java:124) at Org.hibernate.exception.JDBCExceptionHelper.convert (jdbcexceptionhelper.java:66) at Org.hibernate.jdbc.AbstractBatcher.executeBatch (abstractbatcher.java:275) at Org.hibernate.engine.ActionQueue.exeCuteactions (actionqueue.java:262) at org.hibernate.engine.ActionQueue.executeActions ( actionqueue.java:178) at Org.hibernate.event.def.AbstractFlushingEventListener.performExecutions (abstractflushingeventlistener.java:321 ) at Org.hibernate.event.def.DefaultFlushEventListener.onFlush ( defaultflusheventlistener.java:51) at Org.hibernate.impl.SessionImpl.flush ( sessionimpl.java:1206) at Org.hibernate.impl.SessionImpl.managedFlush (Sessionimpl.java : 375) at Org.hibernate.transaction.JDBCTransaction.commit (jdbctransaction.java:137) at Org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit ( Hibernatetransactionmanage r.java:656) at Org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit (Abstractplatform Tr ansactionmanager.java:754) atOrg.springframework.transaction.support.AbstractPlatformTransactionManager.commit (Abstractplatformtransa ctionmanager.java:723) at Org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning ( Transaction aspectsupport.java:393) at Org.springframework.transaction.interceptor.TransactionInterceptor.invoke (transactioninterceptor.java:120) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed ( reflectivemethodinvocation.java:172) at Org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke (exposeinvocationinterceptor.java:90) at Org.springframework.aop.framework.ReflectiveMethodInvocation.proceed ( reflectivemethodinvocation.java:172) at Org.springframework.aop.framework.JdkDynamicAopProxy.invoke (jdkdynamicaopproxy.java:202) at $Proxy 45.queryObjectOut (unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native method) at Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:39) At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:25) at Java.lang.reflect.Method.invoke (method.java:597) at Org.apache.cxf.service.invoker.AbstractInvoker.performInvocation (abstractinvoker.java:180) at Org.apache.cxf.service.invoker.AbstractInvoker.invoke (abstractinvoker.java:96) At Org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke (abstractjaxwsmethodinvoker.java:178) at Org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke (jaxwsmethodinvoker.java:68) at Org.apache.cxf.service.invoker.AbstractInvoker.invoke (abstractinvoker.java:75) At Org.apache.cxf.interceptor.ServIceinvokerinterceptor$1.run (serviceinvokerinterceptor.java:58) at Java.util.concurrent.executors$runnableadapter.call (executors.java:441) at Java.util.concurrent.futuretask$sync.innerrun (futuretask.java:303) at Java.util.concurrent.FutureTask.run (futuretask.java:138) at Org.apache.cxf.workqueue.SynchronousExecutor.execute (synchronousexecutor.java:37) at Org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage (serviceinvokerinterceptor.java:107) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept (phaseinterceptorchain.java:272) at Org.apache.cxf.transport.ChainInitiationObserver.onMessage ( chaininitiationobserver.java:121) at Org.apache.cxf.transport.http.AbstractHTTPDestination.invoke (abstracthttpdestination.java:239) at ORG.APACHE.CXF.TRANSPORT.SERVLET.SERVLEtcontroller.invokedestination (servletcontroller.java:248) at Org.apache.cxf.transport.servlet.ServletController.invoke (servletcontroller.java:222) At Org.apache.cxf.transport.servlet.ServletController.invoke (servletcontroller.java:153) at Org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke (cxfnonspringservlet.java:167) at Org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest (abstracthttpservlet.java:286) at Org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost (Abstracthttpservlet.java : 206) at Javax.servlet.http.HttpServlet.service (httpservlet.java:637) at Org.apache.cxf.transport.servlet.AbstractHTTPServlet.service (abstracthttpservlet.java:262) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:290 ) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:206) at Org.apache.catalina.core.StandardWrapperValve.invoke (standardwrappervalve.java:233) at Org.apache.catalina.core.StandardContextValve.invoke (standardcontextvalve.java:191) at Org.apache.catalina.core.StandardHostValve.invoke (standardhostvalve.java:127) At Org.apache.catalina.valves.ErrorReportValve.invoke (errorreportvalve.java:102) at Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:109) at Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:298) at Org.apache.coyote.http11.Http11Processor.process (http11processor.java:857) at Org.apache.coyote.http11.http11protocol$http11connectionhandler.process (http11protocol.java:588) at org.apache.tOmcat.util.net.jioendpoint$worker.run (jioendpoint.java:489) at Java.lang.Thread.run ( thread.java:662) caused by:java.sql.batchupdateexception:ora-12899: column "its". Vio_business_response_i "." RESPONSE value is too large (actual value: 521, max.) at Oracle.jdbc.driver.DatabaseError.throwBatchUpdateException (databaseerror.java:343) at Oracle.jdbc.driver.OraclePreparedStatement.executeBatch (oraclepreparedstatement.java:10656) at Com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch (newproxypreparedstatement.java:1723) at Org.hibernate.jdbc.BatchingBatcher.doExecuteBatch (batchingbatcher.java:70) at Org.hibernate.jdbc.AbstractBatcher.executeBatch (abstractbatcher.java:268) More |
Question: Clearly the string to be inserted done substring (0,512), why say the actual value of 521,?
Answer: This is because the string to be inserted contains Chinese, which occupies one position when substring, but has more than one location in the database.
Resolution: 1, to insert the string to intercept as little as possible, such as substring (0, 400)
2, the insertion of the string encoding first encoded processing and then interception, such as Urlencoder.encode (str, "Utf-8"), so that substring (0,512) is right