Have a table and a sproc setup in Sybase as follows:
create table testtab (f float)
create proc insert_testtab @f float as insert testtab values(@f)
And a java object that holds a Double
class TestObj { Double getF() { return 12.34; } }
Using SimpleJdbcCall & BeanPropertySqlParameterSource:
SqlParameterSource params = new BeanPropertySqlParameterSource(new TestObj());
SimpleJdbcCall call = new SimpleJdbcCall(dataSource).withProcedureName("insert_testtab");
call.execute(params);
What happens is that 12.0 gets inserted into the database, rather than 12.34. It appears that underneath the covers, BeanPropertySqlParameterSource as passing the number to the sproc as a java.sql.Types.NUMERIC and is truncating the decimals plases.
Can anyone help explain this, is this a problem maybe with the Sybase code in Spring, or maybe I am doing something incorrectly?