title: Getting generated key from DB2 using MyBatis
body: <p>I have a table that generates with an auto-generated column but I am unable to retrieve the ID using MyBatis. I have proven through tests that the SQL is working and that the rows are being inserted but I cannot get the ID generated.</p>
  
  <p>The XML configuration is:</p>
  
  <pre><code>&lt;insert id="insertRequestTrackingRow" parameterType="map"&gt;
      INSERT INTO XML_LOG_T (REQ_SRC_SYS_CDE, REQ_USR_ID, REQ_XML_DOC, ROW_CRT_DTM, ROW_UPDT_DTM)
      VALUES (#{sourceSystemCode}, #{userID}, #{message}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
  &lt;/insert&gt;
  </code></pre>
  
  <p>On the XML_LOG_T is a column, REQ_ID, that is auto-generated. My mapper interface is:</p>
  
  <pre><code>public interface UdbDataMapper {
      int insertRequestTrackingRow(
              @Param("message") String message,
              @Param("sourceSystemCode") String sourceSystemCode,
              @Param("userID") String userID);
  }
  </code></pre>
  
  <p>What is returned is always 1, which I believe is the number of records inserted. I'm sure I am missing something obvious but cannot see the wood for the trees.</p>