java - output param on simplejdbccall -
The
output a single integer to me the ultimate and 5 varchar input parameters, no matter what I tried I with a stored procedure output are not seem to get the ultimate back I ran sproc on DR and it came back with the data, so I can not see what I was doing wrong.
Anyone know how to get an output ultimate from simplejdbccall
I have something like this:
SimpleJdbcCall simpleJdbcCall = New SimpleJdbcCall (getDatasourceForEnvironment ()) .withProcedureName ( "_Get_Id") .declareParameters (new SqlParameter ( "MyID", Types.VARCHAR), new SqlParameter ( "MySourceID", Types.VARCHAR), new SqlParameter ( "MyLocationID", Types.VARCHAR) , New SqlParameter ("MyVisitID", Types.VARCHAR), New SqlParameter ("MyVisitDate", Types.VARCHAR)); HashMap & LT; String, string & gt; Input = new hashmop & lt; String, string & gt; (); Input.put ("MyID", myObj.getMyID ()); Input.put ("MySourceID", myObj.getMySourceID ()); Input.put ("MyLocationID", myObj.getMyLocationID ()); Input.put ("MyVisitID", myObj.getMyVisitID ()); Input.put ("MyVisitDate", myObj.getMyVisitDate ()); System.out.println (simpleJdbcCall.execute);
There were two things that were not misunderstand me:
< Li> I was connected to the wrong database, writing a more granular unit test revealed my error.
-
Since return from "execution" is a map, output params are case-sensitive.
Long story short, there is nothing special you need to do - Spring production parameters by default. In addition, MapSqlParameterSource is a very clean way to go along with such methods.
Comments
Post a Comment