The following error occurs when you use Hibernate to save data to an Oracle database:
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 occurred 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: 656)
At org. springframework. transaction. support. AbstractPlatformTransactionManager. processCommit (AbstractPlatformTransactionManager. java: 754)
At org. springframework. transaction. support. AbstractPlatformTransactionManager. commit (AbstractPlatformTransactionManager. java: 723)
At org. springframework. transaction. interceptor. TransactionAspectSupport. commitTransactionAfterReturning (TransactionAspectSupport. 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. abstrminvocation (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. Maid. invoke (fig. 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 value 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.