我有一个存储过程,只有一个整数输出param和5个varchar输入params,不管我尝试了什么,我似乎都无法得到输出param。我已经在db上运行了sproc,它返回了数据,所以我看不出我做错了什么。
有人知道如何从simplejdbccall获得输出参数吗?
我有这样的事情:
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< String, String > input = new HashMap< String, String >();
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( input ) );发布于 2011-09-03 00:56:37
有两件事我错了:
长话短说,没有什么特别的事情需要做- Spring默认包括输出参数。此外,MapSqlParameterSource是使用这些方法的一种更干净的方法。
https://stackoverflow.com/questions/7279783
复制相似问题