title: Converter doesn't work and not taken by criteria
body: <p>i'm new here^^</p>
  
  <p>i'm working with a db in which boolean are registered as VARCHAR(3) So i made a converter :</p>
  
  <pre><code>import javax.persistence.AttributeConverter;
  import javax.persistence.Converter;
  
  @Converter
  public class BooleanToStringConverter implements
      AttributeConverter&lt;Boolean, String&gt; {
  
  @Override
  public String convertToDatabaseColumn(Boolean value) {
      if (value == null)
          return "";
      else if (value)
          return "OUI";
      else
          return "NON";
  
  }
  
  @Override
  public Boolean convertToEntityAttribute(String value) {
      if (value == null)
          return null;
      else if (value.trim().equals("OUI"))
          return true;
      else if (value.trim().equals("NON"))
          return false;
      else if (value.trim().equals(""))
          return null;
      else
          throw new IllegalStateException("Invalid boolean character: "
                  + value);
  }
  }
  </code></pre>
  
  <p>i put my annotations  @Convert: </p>
  
  <pre><code>public class Institution extends AbstractHREntity {
  
  @Column(name = "IDOU00")
  private String code;
  @Column(table = "ZEXX", name = "LBOULG")
  private String libelle;
  @Column(table = "ZEXX", name = "LBOUSH")
  private String abreviation;
  @Column(table = "ZEYY", name = "LIBEXL")
  private String libelleLong;
  @Convert(converter = BooleanToStringConverter.class)
  @Column(table = "ZEZZ", name = "ESTBUDGET", length = 3)
  private Boolean isBudget;[/CODE]
  </code></pre>
  
  <p>But when i do a request with a criteria :</p>
  
  <pre><code>public List&lt;Institution&gt; findInstitutions(RechercheInstitutionData datas) throws DaoException{
      List&lt;Institution&gt; resultList = new ArrayList&lt;Institution&gt;();
      DetachedCriteria criteria = DetachedCriteria.forClass(Institution.class, "institution");
  
      if(null!=datas.getInstitutionSearched())
      {
          if (StringUtils.isNotBlank(datas.getInstitutionSearched().getLibelleLong())){
              criteria.add(Restrictions.like("institution.libelleLong", datas.getInstitutionSearched().getLibelleLong().toUpperCase(), MatchMode.START));             
          }
          if (StringUtils.isNotBlank(datas.getInstitutionSearched().getAbreviation())){
              criteria.add(Restrictions.like("institution.abreviation", datas.getInstitutionSearched().getAbreviation().toUpperCase(), MatchMode.START));             
          }
          if (StringUtils.isNotBlank(datas.getInstitutionSearched().getLibelle())){
              criteria.add(Restrictions.like("institution.libelle", datas.getInstitutionSearched().getLibelle(), MatchMode.START).ignoreCase());              
          }
          if (StringUtils.isNotBlank(datas.getInstitutionSearched().getCode())){
              criteria.add(Restrictions.like("institution.code", datas.getInstitutionSearched().getCode(), MatchMode.START));             
          }
          criteria.addOrder(Order.asc("institution.code"));
      }
      resultList = find(criteria);
      return resultList;
  }
  </code></pre>
  
  <p>i had this error that occurred : </p>
  
  <pre><code>10:25:31,172 INFO  [RechercheInstitution.beans.RechercheInstitutionBean] (http-localhost/127.0.0.1:8080-5) --&gt; findInstitutions()
  10:25:32,549 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) Hibernate: select this_.NUDOSS as NUDOSS1_35_0_, this_.IDOU00 as IDOU2_35_0_, this_1_.TBUDGE as TBUDGE1_39_0_, this_2_.LIBEXL as LIBEXL1_37_0_, this_3_.LBOUSH as LBOUSH1_36_0_, this_3_.LBOULG as LBOULG2_36_0_ from ZE00 this_ left outer join ZEWD this_1_ on this_.NUDOSS=this_1_.NUDOSS left outer join ZE04 this_2_ on this_.NUDOSS=this_2_.NUDOSS left outer join ZE01 this_3_ on this_.NUDOSS=this_3_.NUDOSS where this_3_.LBOUSH like ? order by this_.IDOU00 asc
  
  10:25:33,310 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost/127.0.0.1:8080-5) SQL Error: -99999, SQLState: 07006
  10:25:33,311 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost/127.0.0.1:8080-5) Data type mismatch. (For input string: "OUI")
  10:25:33,313 ERROR [RechercheInstitution.ejb.institution.InstitutionMgrBean] (http-localhost/127.0.0.1:8080-5) InstitutionMgrBean.findInstitutions : common_HR.exception.DaoException: org.hibernate.exception.SQLGrammarException: could not execute query
  10:25:33,315 INFO  [RechercheInstitution.beans.RechercheInstitutionBean] (http-localhost/127.0.0.1:8080-5) &lt;-- findInstitutions()
  </code></pre>
  
  <p>It looks like it doesn't use my converter, i tried breakpoints it doesn't go into my converter... In converter doc it says "all you have to do is put the @convert" but apparently no... Please help i'm really lost.</p>