Note that there are some explanatory texts on larger screens.

plurals
  1. POStored procedure output parameter set back to POJO by iBATIS
    primarykey
    data
    text
    <p>I'm using iBATIS to call a Stored Procedure on MSSQL Server, the input parameters are properties on a POJO that is put to the map:</p> <pre><code>Map&lt;String, Object&gt; saveMap = new HashMap&lt;String, Object&gt;(); saveMap.put("obj", myArticle); update("save", saveMap); </code></pre> <p>All parameters are set correctly as input to the procedure so nothing wrong there. But one of the parameters is a output-parameter and and I was expecting it to be set back to the POJO but instead one extra mapping <code>"obj.new"=false</code> is put the map by iBATIS. Here's a simplified version of the mapping showing the basic idea:</p> <pre><code> &lt;procedure id="save"&gt; {&lt;include refid="Core.returned_value" /&gt; CALL SPRC_ARTICLE_NAME_SAVE ( &lt;include refid = "Core.common_fields" /&gt; @pArticle_id = #obj.art_id# , @pArtname = #obj.artname# , @pNewArticleName_flg = #obj.new,mode=INOUT# )} &lt;/procedure&gt; </code></pre> <p>After calling the procedure I have two mappings in Map passed to iBATIS:</p> <ul> <li><code>"obj"=POJO</code></li> <li><code>"obj.new"=False</code></li> </ul> <p>Now I see that <a href="http://svn.apache.org/repos/asf/ibatis/java/ibatis-2/trunk/ibatis-2-docs/en/iBATIS-SqlMaps-2_en.pdf" rel="nofollow noreferrer">iBatis documentation</a> saids <em>"When executing stored procedures – iBATIS will create objects for OUTPUT parameters"</em> so it makes sense. But my question is if there a way to instruct iBATIS put back the boolean value to the POJO after the procedure is called? I rather don't do the extra work of getting the value out of the map and set it to the POJO my self.</p> <p>// Uhlén</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload