Java JdbcTemplate执行调用存储过程后,springframework.jdbc更改值

Java JdbcTemplate执行调用存储过程后,springframework.jdbc更改值,java,spring,sql-server-2008,tsql,spring-jdbc,Java,Spring,Sql Server 2008,Tsql,Spring Jdbc,我一直在使用springframework.jdbc库尝试从我的web项目中的数据库检索数据。出于某种原因,跟踪中的这一行: TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 15, parameter value [0.005], value class [java.math.BigDecimal], SQL type

我一直在使用springframework.jdbc库尝试从我的web项目中的数据库检索数据。出于某种原因,跟踪中的这一行:

TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 15, parameter value [0.005], value class [java.math.BigDecimal], SQL type 2
当我在sql server探查器中捕获请求时,似乎将发送到类0.005的值转换为5。正如跟踪所说,发送到类的值的类型为java.math.BigDecimal,然后我使用SQL类型2,即java.SQL.Types.NUMERIC,如下面的示例所示:

declareParameter(new SqlParameter("Deviation", Types.NUMERIC));
我怀疑javalayer或hibernate只发送BigDecimal值的BigInteger部分。我如何解决这个问题,绕过这个问题? 任何建议都很受欢迎。我还以log4j可以跟踪的最爱的级别输入了java中发生的事情的完整跟踪,以及SQLServer探查器捕捉到的内容

java中的跟踪:

DEBUG: org.springframework.jdbc.core.JdbcTemplate - Calling stored procedure [{call sp_MyProcedure(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}]
DEBUG: org.springframework.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 1, parameter value [null], value class [null], SQL type -7
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 2, parameter value [null], value class [null], SQL type 4
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 3, parameter value [null], value class [null], SQL type 4
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 4, parameter value [329689], value class [java.lang.Integer], SQL type 4
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 5, parameter value [1], value class [java.lang.Integer], SQL type 4
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 6, parameter value [null], value class [null], SQL type 4
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 7, parameter value [null], value class [null], SQL type 4
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 8, parameter value [2013-09-18], value class [java.lang.String], SQL type 91
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 9, parameter value [2013-09-19], value class [java.lang.String], SQL type 91
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 10, parameter value [null], value class [null], SQL type 91
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 11, parameter value [null], value class [null], SQL type 91
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 12, parameter value [false], value class [java.lang.Boolean], SQL type -7
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 13, parameter value [false], value class [java.lang.Boolean], SQL type -7
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 14, parameter value [false], value class [java.lang.Boolean], SQL type -7
<--Value that becomes converted bellow-->
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 15, parameter value [0.005], value class [java.math.BigDecimal], SQL type 2
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 16, parameter value [null], value class [null], SQL type 4
TRACE: org.springframework.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 17, parameter value [true], value class [java.lang.Boolean], SQL type -7
DEBUG: org.springframework.jdbc.core.JdbcTemplate - CallableStatement.execute() returned 'true'
DEBUG: org.springframework.jdbc.core.JdbcTemplate - CallableStatement.getUpdateCount() returned -1
DEBUG: org.springframework.jdbc.core.JdbcTemplate - CallableStatement.getUpdateCount() returned -1
DEBUG: org.springframework.jdbc.core.JdbcTemplate - SQLWarning ignored: SQL state 'S0001', error code '0', message [20130919: 2]
DEBUG: org.springframework.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource

我不太明白。您有一个值
0.005
,sql server在内部将其转换为
5
?所涉及的数据类型是什么?告诉我们您如何知道它在数据库中是
5
。我更新了案例,提供了有关如何将请求发送到sql server的更多信息。Jim澄清了我是如何知道的,因为我已经在org.springframework.jdbc上设置了一个跟踪到所有的程序。当我使用SQL Server Profiler查看同一个请求时,下面的跟踪吼叫改为5。我还使用了SQL Server Profiler跟踪进行了补充。有什么建议或想法吗?
declare @p1 int
set @p1=8
exec sp_prepexec @p1 output,N'@P0 bit,@P1 int,@P2 int,@P3 int,@P4 int,@P5 int,@P6 int,@P7 date,@P8 date,@P9 date,@P10 date,@P11 bit,@P12 bit,@P13 bit,@P14 decimal(38,3),@P15 int,@P16 bit',N'EXEC sp_MyProcedure @P0, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14, @P15, @P16                                                                                                                                 ',NULL,NULL,NULL,NULL,1,NULL,NULL,N'2013-09-18',N'2013-09-19',NULL,NULL,0,0,0,5,NULL,1
select @p1