ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Poitras Christian" <Christian.Poit...@ircm.qc.ca>
Subject RE: How to pass a parameter with DECIMAL data type
Date Wed, 13 Sep 2006 13:53:19 GMT
If your passing a double to iBATIS, it won't truncate it to DECIMAL(5,2)
before calling the procedure.
You should truncate the data yourself to 2 decimals in the procedure or
in the sql.


From: Brad Balmer [mailto:bbalmer@peapod.com] 
Sent: Tuesday, 12 September 2006 16:59
To: user-java@ibatis.apache.org
Subject: Re: How to pass a parameter with DECIMAL data type

If you are using MySQL 5, could this be an issue using strict sql mode?

Cs2000xli@cs.com wrote: 

	I am passing a parameter for DECIMAL(5, 2) to a stored
procedure. I have the following parameterMap.
	<parameterMap id="getInfoMap" class="map" >
	  <parameter property="dollarAmount" jdbcType="DECIMAL"
javaType="java.math.BigDecimal" mode="IN"/>
	<procedure id="getInfo" parameterMap="getInfoMap">
	      {call sp_getInfo(?)}
	When I call the stored procedure using DAO object, I got the
following error sql error with the cause.
	--- Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation:
Data truncated for column 'dollarAmount' at row 1
	What did I do wrong?


Brad Balmer
Application Architect
Peapod, Inc.

This email may contain confidential or legally privileged information
that is intended only for the individual or entity named as the
recipient. If you are not the intended recipient, you are hereby
notified that any disclosure, copying, distribution, or reliance upon
the contents of this email is strictly prohibited. If you have received
this email in error, please contact the sender so that proper delivery
can be arranged, and then please delete this message. Thank you.

View raw message