tags:

views:

299

answers:

0

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:

Map<String, Object> saveMap = new HashMap<String, Object>();
saveMap.put("obj", myArticle);
update("save", saveMap);

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 "obj.new"=false is put the map by iBATIS. Here's a simplified version of the mapping showing the basic idea:

    <procedure id="save">
    {<include refid="Core.returned_value" />
    CALL SPRC_ARTICLE_NAME_SAVE (
        <include refid = "Core.common_fields" />
        @pArticle_id = #obj.art_id#
    ,   @pArtname = #obj.artname#
    ,   @pNewArticleName_flg = #obj.new,mode=INOUT#
    )}
</procedure>

After calling the procedure I have two mappings in Map passed to iBATIS:

  • "obj"=POJO
  • "obj.new"=False

Now I see that iBatis documentation saids "When executing stored procedures – iBATIS will create objects for OUTPUT parameters" 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.

// Uhlén