ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Yee <r...@cruzio.com>
Subject Re: ORA-01461: can bind a LONG value only for insert into a LONG column
Date Mon, 05 Mar 2007 15:09:07 GMT
Francesco,
Check your DB documentation on the return type of SUBSTR when using a 
Long argument. I think you will find that it returns a Long. This isn't 
an iBATIS issue.

One solution may be to do the SUBSTR using Java instead of the DB.

You might also consider using a Pojo instead of a Map. I think you will 
get better performance from iBATIS.

-Richard


francesco77 wrote:
> I have this error when I try to insert a record into this table:
>
> CREATE TABLE TESTBONAVIA
> (
>   QUERY  CHAR(2000 CHAR),
>   UNO    CHAR(200 CHAR)
> );
>
> Then I have the xml insert like this:
>
> <insert id="provaInsert">
>     	insert into testbonavia(query,uno)
>     	values (#stringa300#,SUBSTR(#stringa300#,1,100) )
> </insert>
>
> And the DAO which use this insert statement is :
>
> public void insertStringTot(String stringa300) {
>     	Map messageKey = (Map) messageKeyOfThread.get();
>     	messageKey.put("stringa300", stringa300);
>     	getSqlMapClientTemplate().insert("ProductServiceQuery.provaInsert",
> messageKey);
>     }
>
> If I have the string which is this :
>
> *000MURF-SIGI-CDV-SAVA            TR-300                       
> 2007030539960892MODOWN00    200703050D4PAB    H3C43054                              
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
              
> CD282LV                                                                             
                                                                                         
                                   
> 04                                                                                  
                                                                                         
                                                                                         
                                              
> 20030129                                                                            
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                    
> D                                         *
>
> The * are used only to delimitate the string and there are NOT part of the
> string!!!!
>
> If I try to execute the DAO insert it fails with this error :
>
> [15:12:28 ERROR]
> com.fiat.mida.controller.common.UnexpectedExceptionHandler.execute(34) -
> unexpected exception [userid=ubonavia,locale=it_IT] is:
>      [java] org.springframework.jdbc.UncategorizedSQLException: SqlMapClient
> operation; uncategorized SQLException for SQL []; SQL state [72000]; error
> code [1461];
>      [java] --- The error occurred in
> com/fiat/mida/model/productservice/dao/ProductService.xml.
>      [java] --- The error occurred while applying a parameter map.
>      [java] --- Check the
> ProductServiceQuery.provaInsert-InlineParameterMap.
>      [java] --- Check the statement (update failed).
>      [java] --- Cause: java.sql.SQLException: ORA-01461: can bind a LONG
> value only for insert into a LONG column
>      [java] ORA-02063: preceding line from DLHZ7LINK1000
>      [java] ; nested exception is
> com.ibatis.common.jdbc.exception.NestedSQLException:
>      [java] --- The error occurred in
> com/fiat/mida/model/productservice/dao/ProductService.xml.
>      [java] --- The error occurred while applying a parameter map.
>      [java] --- Check the
> ProductServiceQuery.provaInsert-InlineParameterMap.
>      [java] --- Check the statement (update failed).
>      [java] --- Cause: java.sql.SQLException: ORA-01461: can bind a LONG
> value only for insert into a LONG column
>      [java] ORA-02063: preceding line from DLHZ7LINK1000
>      [java] Caused by:
>      [java] com.ibatis.common.jdbc.exception.NestedSQLException:
>      [java] --- The error occurred in
> com/fiat/mida/model/productservice/dao/ProductService.xml.
>      [java] --- The error occurred while applying a parameter map.
>      [java] --- Check the
> ProductServiceQuery.provaInsert-InlineParameterMap.
>      [java] --- Check the statement (update failed).
>      [java] --- Cause: java.sql.SQLException: ORA-01461: can bind a LONG
> value only for insert into a LONG column
>      [java] ORA-02063: preceding line from DLHZ7LINK1000
>      [java] at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91)
>      [java] at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447)
>      [java] at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
>      [java] at
> org.springframework.orm.ibatis.SqlMapClientTemplate$9.doInSqlMapClient(SqlMapClientTemplate.java:369)
>      [java] at
> org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)
>      [java] at
> org.springframework.orm.ibatis.SqlMapClientTemplate.insert(SqlMapClientTemplate.java:367)
>      [java] at
> com.fiat.mida.model.productservice.dao.ProductServiceListDao.insertString300(ProductServiceListDao.java:222)
>      [java] at
> com.fiat.mida.model.productservice.dao.ProductServiceListDao$$FastClassByCGLIB$$3e35f499.invoke(<generated>)
>      [java] at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
>      [java] at
> org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:675)
>      [java] at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
>      [java] at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
>      [java] at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
>      [java] at
> org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:568)
>      [java] at
> com.fiat.mida.model.productservice.dao.ProductServiceListDao$$EnhancerByCGLIB$$5fd0b54d.insertString300(<generated>)
>      [java] at
> com.fiat.mida.model.productservice.logic.ProductServiceListService.insertStringa300(ProductServiceListService.java:82)
>      [java] at
> com.fiat.mida.controller.productservice.ProductServiceInfoDetailAction.insertStringa300(ProductServiceInfoDetailAction.java:227)
>      [java] at
> com.fiat.mida.controller.productservice.ProductServiceInfoDetailAction.delete(ProductServiceInfoDetailAction.java:106)
>      [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>      [java] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>      [java] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>      [java] at java.lang.reflect.Method.invoke(Method.java:324)
>      [java] at
> org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:266)
>      [java] at
> org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:167)
>      [java] at
> org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:143)
>      [java] at
> org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:53)
>      [java] at
> org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:64)
>      [java] at
> org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
>      [java] at
> org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
>      [java] at
> org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
>      [java] at
> org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
>      [java] at
> org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
>      [java] at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
>      [java] at
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)
>      [java] at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>      [java] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>      [java] at
> com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
>      [java] at
> com.fiat.mida.controller.security.AuthorizationFilter.doFilter(AuthorizationFilter.java:117)
>      [java] at
> com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
>      [java] at
> org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:61)
>      [java] at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
>      [java] at
> com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
>      [java] at
> com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
>      [java] at
> com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
>      [java] at
> com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
>      [java] at
> com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
>      [java] at
> com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
>      [java] at java.lang.Thread.run(Thread.java:534)
>      [java] Caused by: java.sql.SQLException: ORA-01461: can bind a LONG
> value only for insert into a LONG column
>      [java] ORA-02063: preceding line from DLHZ7LINK1000
>      [java] at
> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:137)
>      [java] at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
>      [java] at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)
>      [java] at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:625)
>      [java] at
> oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
>      [java] at
> oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:629)
>      [java] at
> oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1153)
>      [java] at
> oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2932)
>      [java] at
> oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3023)
>      [java] at
> com.evermind.sql.FilterPreparedStatement.execute(FilterPreparedStatement.java:255)
>      [java] at
> com.evermind.sql.FilterPreparedStatement.execute(FilterPreparedStatement.java:255)
>      [java] at
> com.evermind.sql.PreparedStatementBCELProxy.execute(PreparedStatementBCELProxy.java:363)
>      [java] at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeUpdate(SqlExecutor.java:81)
>      [java] at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteUpdate(GeneralStatement.java:200)
>      [java] at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:78)
>      [java] ... 47 more
>      [java] [15:12:28 WARN]
> org.apache.struts.util.PropertyMessageResources.loadLocale(265) -   Resource
> org/apache/struts/action/LocalStrings_en_US.properties Not Found.
>      [java] [15:12:28 WARN]
> org.apache.struts.util.PropertyMessageResources.loadLocale(265) -   Resource
> org/apache/struts/action/LocalStrings_en.properties Not Found.
>      [java] [15:12:28 DEBUG]
> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
> key(errors.header) not found: search in properties file
>      [java] [15:12:28 WARN]
> org.apache.struts.util.PropertyMessageResources.loadLocale(265) -   Resource
> com/fiat/mida/support/struts/MessageResources_it_IT.properties Not Found.
>      [java] [15:12:28 WARN]
> org.apache.struts.util.PropertyMessageResources.loadLocale(265) -   Resource
> com/fiat/mida/support/struts/MessageResources_it.properties Not Found.
>      [java] [15:12:28 WARN]
> org.apache.struts.util.PropertyMessageResources.loadLocale(265) -   Resource
> com/fiat/mida/support/struts/MessageResources_en_US.properties Not Found.
>      [java] [15:12:28 DEBUG]
> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
> key(errors.footer) not found: search in properties file
>      [java] [15:12:28 DEBUG]
> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
> key(errors.prefix) not found: search in properties file
>      [java] [15:12:28 DEBUG]
> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
> key(errors.suffix) not found: search in properties file
>      [java] [15:12:28 DEBUG]
> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
> key(errors.header) not found: search in properties file
>      [java] [15:12:28 DEBUG]
> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
> key(errors.prefix) not found: search in properties file
>      [java] [15:12:28 DEBUG]
> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(85) -
> key(errors.unexpected) not found: search in properties file
>      [java] [15:12:29 DEBUG]
> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
> key(errors.unexpected) not found: search in properties file
>      [java] [15:12:29 DEBUG]
> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
> key(errors.suffix) not found: search in properties file
>      [java] [15:12:29 DEBUG]
> com.fiat.mida.support.struts.LocalizedMessageResources.getMessage(63) -
> key(errors.footer) not found: search in properties file
>
> I'm in difficulty to understand this error.
> I need a big HELP from someone,
>
> Thanks a lot
> Francesco
>
>   


Mime
View raw message