title: How do I create an object in MyBatis (Spring) mapper using select on a table (Spring)?
body: <p>I am new to MyBatis and Spring. I have two SQL tables, let's say a list of Universities and a list of Students.</p>
  
  <pre><code>UNIVERSITY table has id, name, listOfStudents
  
  STUDENTS table has name_ofStudent, GPA, age, major, id, universityId
  </code></pre>
  
  <p>I have University.java, Student.java, UniversityManager.java, StudentManager.java (both with crud operations in their manager) (read's parameter is an int id).</p>
  
  <p>If this is my UniversityMapper.xml (below) how do I "SELECT" (by ID) a University? I know how the basic select works but my main question is once I select get by id the name of the university how do I also so get the list of students belonging to that students?</p>
  
  <p>I want to know how to select using mybatis the list of students that match the universityID and create a student object and make it part of the university object.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"&gt;
  &lt;mapper namespace="java.University"&gt;
    &lt;resultMap id="BaseResultMap" type="java.University"&gt;
      &lt;id column="ID" jdbcType="VARCHAR" property="id" /&gt;
      &lt;result column="NAME" jdbcType="VARCHAR" property="name" /&gt;
    &lt;/resultMap&gt;
    &lt;insert id="createUniversity" parameterType="java.University"&gt;
      insert into DATABASE.University(ID, NAME)
      values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR})
          &lt;/insert&gt;
  
     &lt;select id="getUniversity" parameterType="int" resultMap="java.University"&gt;
  
  (This is where I need help)
  
  &lt;/select&gt;
  
     &lt;update id="updateUniversity" parameterType="java.University"&gt;
      update DATABASE.University
      set ID= #{id,jdbcType=VARCHAR},
        NAME= #{name,jdbcType=VARCHAR}
    &lt;/update&gt;
    &lt;delete id="deleteUniversity" parameterType="java.University"&gt;
      delete from DATABASE.University
      where ID= #{id,jdbcType=VARCHAR}
    &lt;/delete&gt;
  &lt;/mapper&gt;
  </code></pre>