-
Aug 9th, 2012, 12:58 AM
#1
how to call stored procedure in spring and the result set should be Map object
Hi friends,
can anyone help me on these, i am trying to calling a stored procedure, it should be the resultset in the form of Map object. For these i used spring jdbc concept but i am getting a error like BadSqlGrammerException.
dao classes method.
public Map getClassificationView(String sUser,String sLocation,String sPattern, String sCurrPage){
LOG.info(">>>>>>>>>>>METHOD NAME getClassificationView Starts in Classification DAO>>>>>>>>>>>>>");
ProcedureAndFunctions stproc = new ProcedureAndFunctions();
stproc.setJdbcTemplate(getJdbcTemplate());
stproc.setSql("DF_Get_classification_view");
stproc.declareParameter(new SqlOutParameter(sLocation,Types.VARCHAR));
stproc.declareParameter(new SqlOutParameter("null", Types.VARCHAR));
stproc.declareParameter(new SqlOutParameter(sCurrPage, Types.INTEGER));
stproc.declareParameter(new SqlOutParameter("Y", Types.VARCHAR));
stproc.compile();
Map results = stproc.execute();
for (Iterator it = results.keySet().iterator(); it.hasNext()
{
System.out.println(results.get(it.next()));
}
LOG.info(">>>>>>>>>>>METHOD NAME getClassificationView Ends in Classification DAO>>>>>>>>>>>>>");
return results;
}
ProcedureAndFunctions.java:
public class ProcedureAndFunctions extends StoredProcedure
{
public ProcedureAndFunctions()
{
}
public Map execute()
{
Map inputs = new HashMap<String,Object>();
return super.execute(inputs);
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules