title: How to call a stored procedure from MyBatis Java?
body: <p>I am getting the error:</p>
  
  <blockquote>
    <p>org.mybatis.spring.MyBatisSystemException: nested exception is org. apache. ibatis.          exceptions.PersistenceException: </p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for .." </p>
  </blockquote>
  
  <p>when I call stored procedure from mybatis using Java.</p>
  
  <p>I am using <em>PostgreSQL</em> as a database and a <em>Spring MVC</em> framework. For this, my DAO class calling the stored procedure is:  </p>
  
  <pre><code>Orders orders=new Orders();
  </code></pre>
  
  <p>Values are set in orders variable programatically.</p>
  
  <pre><code>Integer insert= getSqlSession().insert("records",orders);**
  </code></pre>
  
  <p>My mybatis file looks like this:</p>
  
  <pre><code>&lt;insert id="records" parameterType="Orders" statementType="CALLABLE"&gt;
   {call fn_records_tbl(#{rId,javaType=Integer,jdbcType=INTEGER,mode=IN},#{state,javaType=String,jdbcType=CHAR,mode=IN},#{uId,javaType=Integer,jdbcType=INTEGER,mode=IN},#{status,javaType=String,jdbcType=CHAR,mode=IN})}
  &lt;/insert&gt;
  </code></pre>
  
  <p>My stored procedure syntax is:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION fn_records_tbl(rId integer, state character,uId integer, status character)
  
  RETURNS void AS
  
  $BODY$
  DECLARE
  
      -- my code
  BEGIN
  
      -- my code
  END
  
  $BODY$
  
  LANGUAGE plpgsql VOLATILE
  COST 100;
  
  ALTER FUNCTION fn_records_tbl(integer, character, integer, character)
  OWNER TO mydba;
  </code></pre>
  
  <p>and my entity class  for passing parameters is:</p>
  
  <pre><code> public class Orders implements Serializable {
  
    private static final long serialVersionUID = 267216928694677437L;
    private Integer uId;
    private Integer rId;
    private String status;
    private String state;
  
       // here are my setter and getter
   }
  </code></pre>