title: MyBatis, insert with complex object
body: <p>I have the following scenario:</p>
  
  <pre><code>public class MyObj{
      private String myField_1
      private String myField_2
      private MyChildObj myChild
      // Constructor &amp; get/set
  }
  
  public class MyChildObj{
      private String myField_3
      private String myField_4
      // Constructor &amp; get/set
  }
  </code></pre>
  
  <p>on my Query.xml  i wrote the insert in this way:</p>
  
  <pre><code>&lt;insert id="insertMyObj" parameterType="MyObj"&gt;
      INSERT INTO MY_TABLE    (   FIELD_1,
                                  FIELD_2,
                                  FIELD_3,
                                  FIELD_4)
      values  (   #{myField_1},
                  #{myField_2},
                  #{myField_3},
                  #{myField_4},
      )
  &lt;/insert&gt;
  </code></pre>
  
  <p>after reading mybatis Result Map Guide i tried to add following lines on mybatis-config.xml file: </p>
  
  <pre><code>&lt;typeAliases&gt;
      &lt;typeAlias alias="MyObj"        type="myPackage.MyObj"/&gt;
      &lt;typeAlias alias="MyChildObj"   type="myPackage.MyChildObj"/&gt;
  &lt;/typeAliases&gt;
  
  &lt;resultMap id="insertObj" type="MyObj"&gt;
      &lt;result property="myField_1"  column="FIELD_1"/&gt;
      &lt;result property="myField_2"  column="FIELD_2"/&gt;
      &lt;association property="PrimaryKeyMap" resultMap="PrimaryKey"/&gt;
  &lt;/resultMap&gt;
  
  &lt;resultMap id="PrimaryKeyMap" type="PrimaryKey"&gt;
      &lt;result property=myField_3  column="FIELD_3"/&gt;
      &lt;result property="myField_4"  column="FIELD_4"/&gt;
  &lt;/resultMap&gt;
  </code></pre>
  
  <p>but i keep getting  the following error:</p>
  
  <pre><code>### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: xx; columnNumber: xx; Element type "resultMap" must be declared.
  </code></pre>
  
  <p>Can anyone clarify me how to set up this?</p>