title: JPA 2.1 Attribute Converter convert enum still insert int
body: <p>i'm  using spring data jpa with  hibernate as provider.
  i'm trying to persist my enums on  varchar(enum.tostring) instead of (0,1,2)
  my enum class:</p>
  
  <pre><code>public enum MagasinType {
  PRINCIPAL {
      @Override
      public String toString() {
          return "Principale".toUpperCase();
      }
  },
  SECONDARY {
      @Override
      public String toString() {
          return "Secondaire".toUpperCase();
      }
  },
  MOBILE {
      @Override
      public String toString() {
          return "Mobile".toUpperCase();
      }
  };
  public abstract String toString();
  }
  </code></pre>
  
  <p>my converter</p>
  
  <pre><code>@Converter(autoApply = true)
  public class MagasinConverter implements attributeConverter           &lt;MagasinType,String&gt;{
  
  @Override
  public String convertToDatabaseColumn(MagasinType magasinType) {
      switch (magasinType){
          case MOBILE:return "MOBILE";
          case PRINCIPAL:return "PRINCIPAL";
          case SECONDARY:return "SECONDARY";
          default:throw new IllegalArgumentException("valeur incorrecte" + magasinType);
      }
  }
  
  @Override
  public MagasinType convertToEntityAttribute(String s) {
      switch (s){
          case "MOBILE": return MagasinType.MOBILE;
          case "SECONDARY": return MagasinType.SECONDARY;
          case "PRINCIPAL": return MagasinType.PRINCIPAL;
          default:throw new IllegalArgumentException("valeur incorrecte" + s);
      }}}
  </code></pre>
  
  <p>my entity</p>
  
  <pre><code> @Entity
   @Table(name = "MAGASIN")
   public class Magasin extends AbstractEntity {
  
  @Column(name = "LIBELLE", nullable = false)
  private String libelle;
  
  @Column(name = "DESCR")
  private String descr;
  
  
  @Convert(converter = MagasinConverter.class)
  private MagasinType type;
  
  @Column(name = "LOCATION")
  private String localisation;
  
  @Version
  private long version;
  //getters setters omitted
  }
  </code></pre>
  
  <p>my java config : <a href="https://gist.github.com/anonymous/480ef7a58cdcc50e7481" rel="nofollow">https://gist.github.com/anonymous/480ef7a58cdcc50e7481</a></p>
  
  <p>my app.properties : <a href="https://gist.github.com/anonymous/685eaca98fcba9c33872" rel="nofollow">https://gist.github.com/anonymous/685eaca98fcba9c33872</a></p>
  
  <p>and finally my test method : <a href="https://gist.github.com/anonymous/8bb60fee39a201558e19" rel="nofollow">https://gist.github.com/anonymous/8bb60fee39a201558e19</a></p>
  
  <p>please help me on it,  i  want to use @convert new jpa2.1 feature instead of
  @enumerated</p>