First, your problem with JConnect. There is documented in the JConnect reference guide one sentence that you should never overlook.

Executing stored procedures

•If you execute a stored procedure in a CallableStatement object that represents parameter values as question marks, you get better performance than if you use both question marks and literal values for parameters. Further, if you mix literals and question marks, you cannot use output parameters with a stored procedure.

Be certain that you are not mixing literals with the question marks when executing the sp.
 
As far as BigDecimal not mapping, I currently have defined in one class a BigDecimal field that I am mapping in my SQLMap from a DECIMAL jdbc type without any issues. The database has this field defined as Money.

result column="unit_price" property="unitPrice" jdbcType="DECIMAL"

I would recommend looking through the JConnect Programmers Guide to ensure that you are mapping things correctly. There is a great deal of information in the guide and I can say from experience that "The Devil is in the details." There are many little "gotchas" in this guide that you must pay attention to.



From: "Gaer,Jeffrey J" <[EMAIL PROTECTED]> [mailto:"Gaer,Jeffrey J" <[EMAIL PROTECTED]>]
Sent: Thursday, May 24, 2007 7:59 AM
To: [email protected]
Subject: problems using stored procs on sybase

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.java:375)

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

      at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.sqlExecuteQuery(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.executeQueryWithCallback(GeneralStatement.java:185)

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

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

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

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

      at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.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>     

 

 

Reply via email to