The following error occurs when you use Hibernate to save data to an oracle database:
?
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 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 45 46 48 49 50 51 53 54 55 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
19:52:35, 156 WARN JDBCExceptionReporter: 100-SQL Error: 1461, SQLState: 72000 19:52:35, 156 ERROR JDBCExceptionReporter: 101-ORA-01461: Can only bind the LONG value of the LONG column to insert 19:52:35, 156 WARN JDBCExceptionReporter: 100-SQL Error: 1461, SQLState: 72000 19:52:35, 156 ERROR JDBCExceptionReporter: 101-ORA-01461: Can only bind the LONG value of the LONG column to insert 19:52:35, 156 ERROR cannot actflushingeventlistener: 324-cocould not synchronize database state with session org. hibernate. queryTimeoutException: cocould not execute JDBC batch update at org. hibernate. exception. SQLStateConverter. convert (SQLStateConverter. java: 124) at org. hibernate. exception. JDBCExceptionHelper. convert (JDBCExceptionHelper. java: 66) at org.hibernate.jdbc.AbstractBatcher.exe cuteBatch (AbstractBatcher. java: 275) at org.hibernate.engine.ActionQueue.exe cuteActions (ActionQueue. java: 262) at org.hibernate.engine.ActionQueue.exe cuteActions (ActionQueue. java: 178) at org. hibernate. event. def. abstractFlushingEventListener. extends mexecutions (AbstractFlushingEventListener. java: 321) at org. hibernate. event. def. defaultFlushEventListener. onFlush (defaflusheventlistener. 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 (HibernateTransactionManager. java: 6 56) at org. springframework. transaction. support. abstractPlatformTransactionManager. processCommit (AbstractPlatformT ra nsactionManager. java: 754) at org. springframework. transaction. support. abstractPlatformTransactionManager. commit (AbstractPlatformTransact ionManager. java: 723) at org. springframework. transaction. interceptor. transactionAspectSupport. commitTransactionAfterReturning (Transa cti onAspectSupport. 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 $ Proxy45.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. using minvocation (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.exe cute (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 (maid. 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-01461: Can only bind the LONG value of the LONG column to insert at oracle. jdbc. driver. databaseError. throwBatchUpdateException (DatabaseError. java: 343) at oracle.jdbc.driver.OraclePreparedStatement.exe cuteBatch (OraclePreparedStatement. java: 10656) at com.mchange.v2.c31_impl.newproxypreparedstatement.exe cuteBatch (NewProxyPreparedStatement. java: 1723) at org. hibernate. jdbc. batchingBatcher. doExecuteBatch (BatchingBatcher. java: 70) at org.hibernate.jdbc.AbstractBatcher.exe cuteBatch (AbstractBatcher. java: 268 )... 55 more |
Cause: If a field is varchar2 (1024) but the actual length of the field to be inserted exceeds the maximum length of 4000 allowed by varchar2, oracle automatically converts the field value to the Long type, then the system prompts that the insert operation failed.
Solution: 1. Are you sure you want to insert a value that exceeds the defined length? Otherwise, judge and intercept the length.
2. If yes, use clob or blob as the field, or use a file instead. Save the file address as the field.