title: MyBatis enum usage
body: <p>I know this has been asked before, but I wasn't able to implement a solution based on the information I found so far. so perhaps someone can explain it to me.</p>
  
  <p>I have a table "status". It has two columns:id and name. id is a PK.</p>
  
  <p>Instead of using a POJO Status, I would like to use an enum. I created such an enum as follows:</p>
  
  <pre><code>public enum Status {
      NEW(1), READY(2), CLOSED(3);
  
      private int id;
  
      public void setId(int id) {
          this.id = id;
      }
  
      public int getId() {
          return this.id;
      }
  
      Status(int id) {
          this.id = id;
      }
  }
  </code></pre>
  
  <p>here is my mapper
      </p>
  
  <pre><code>     &lt;select id="getStatusByName" resultType="Status" parameterType="String"&gt;       
          SELECT  ls.id, ls.name
          FROM status AS ls
          WHERE ls.name = #{name}
      &lt;/select&gt;
  </code></pre>
  
  <p></p>
  
  <p>but for some reason, when I try to retrieve an enum, something breaks, but no exception is thrown.</p>