ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gaer,Jeffrey J" <jeffrey.g...@dads.state.tx.us>
Subject problems using stored procs on sybase
Date Thu, 24 May 2007 14:59:00 GMT
Running java 1.4.2 and Sybase jconnect driver ( I think we are version 12.0
) we had two problems running a particular stored proc. 

 

The first was a null pointer exception processing the results. The proc set
an output value but did not return a result  set. Adding a 'dummy' result
set to the proc eliminated the problem. 

--------------------

Caused by: java.lang.NullPointerException

      at
com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.jav
a:375)

      at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQueryProcedure(SqlExec
utor.java:291)

      at
com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuer
y(ProcedureStatement.java:34)

-----------------------

 

The other occurs when using sql DECIMAL types. We tried using both
BigDecimal and Double as the java type, but get the following exception. We
were able to work around this by adding a string conversion in the proc and
passing strings. I was looking for a way to set the precession in Ibatis,
but could not find one, the precession property seems to be only available
for .net. 

 

----------------------------------

--- Cause: com.sybase.jdbc2.jdbc.SybSQLException: Arithmetic overflow during
implicit conversion of DECIMAL value '2905.00' to a NUMERIC field .

 

Caused by: com.sybase.jdbc2.jdbc.SybSQLException: Arithmetic overflow during
implicit conversion of DECIMAL value '2905.00' to a NUMERIC field .

 

      at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWith
Callback(GeneralStatement.java:185)

      at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForO
bject(GeneralStatement.java:104)

      at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapEx
ecutorDelegate.java:561)

      at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapEx
ecutorDelegate.java:536)

      at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSession
Impl.java:93)

      at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientIm
pl.java:70)

 

------------------------

Here's the  sqlMap definition, we tried both with and without setting the
types in the result map.Thanks in advance for any insight.

-----------------------------

      <resultMap id="bedsResult" class="java.util.HashMap" >

                  <result 

                  property="total_fee" 

                        

                  column="AMOUNT"/>

      </resultMap>

      

      <parameterMap id="bedsCalcFeeParam" class="bedsFee" >

            <parameter property ="id_app" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN"/>

            <parameter property ="id_service" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN"/>       

            <parameter property ="app_action_string" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN"/>         

            <parameter property ="total_capacity" jdbcType="INTEGER"
javaType="java.lang.Integer" mode="IN"/>

            <parameter property ="dt_effective" jdbcType="DATE"
javaType="java.util.Date" mode="IN"/> 

            <parameter property ="total_fee"
javaType="java.math.BigDecimal"  jdbcType="DECIMAL"       mode="INOUT"/>

      </parameterMap>   

      

      <procedure id="bedsCalcFee" parameterMap="bedsCalcFeeParam"
resultClass="java.util.HashMap">

            {call proc_calculate_fee_opa (?,?,?,?,?,?)}

      </procedure>      

 

 


Mime
View raw message