title: Returning values from MyBatis <insert> mapped methods
body: <p>I have a Java project that uses MyBatis to access a PostgreSQL database. PostgreSQL allows to return fields of a newly created row after an <code>INSERT</code> statement, and I want to use it to return the auto-generated <code>BIGSERIAL</code> <code>id</code> of newly created records. So, I change the <code>insert</code> command in the XML to use feature of PostgreSQL, add an <code>resultType="long"</code> attribute to the <code>&lt;insert&gt;</code> tag, and in the Java interface of the mapper I set the insertion method to return <code>long</code> instead of <code>void</code>.</p>
  
  <p>When I try to run this, I get an <code>org.xml.sax.SAXParseException</code> saying that <code>Attribute "resultType" must be declared for element type "insert"</code>.</p>
  
  <p>Now, when I change the <code>&lt;insert&gt;</code> tag to <code>&lt;select&gt;</code> everything works fine, but it bothers me that I use <code>&lt;select&gt;</code> tag to perform an <code>INSERT</code> statement.</p>
  
  <p>Is there a way to make methods mapped to <code>&lt;insert&gt;</code> tags return results, or is MyBatis not designed for that, and I should just keep them as <code>&lt;select&gt;</code> tags?</p>