title: PF autocomplete showing wrong label when validation fails
body: <p>I'm having a weird behaviour with primefaces' <code>autocomplete</code>.</p>
  
  <p>The component works perfectly fine when I submit a form without validation errors, or with errors on other form fields. However, if validation fails on the autocomplete, the label is replaced by the item <code>@Id</code> field.</p>
  
  <p>I suspect something is wrong with the converter I'm using. What the converter does, basically, is get the entity's @Id value and insert the actual entity in the component's attribute map with the @Id value as its key.</p>
  
  <p>Here is my xhtml:</p>
  
  <pre><code>                            &lt;p:autoComplete
                                  id="autoComp"
                                  value="#{action.timeTable}"
                                  completeMethod="#{action.timeTables}"
                                  var="tt"
                                  itemLabel="#{tt.description}"
                                  itemValue="#{tt}"
                                  dropdown="true"
                                  minQueryLength="3"
                                  forceSelection="true"
                                  converter="entityConverter"
                                  size="30"
                                  required="true"
                                  maxResults="10"&gt;
  
                                  &lt;f:validator validatorId="customValidator" /&gt;
  
                              &lt;/p:autoComplete&gt;
  </code></pre>
  
  <p>And here is my converter code:</p>
  
  <pre><code>@FacesConverter("entityConverter")
  public class EntityConverter implements Converter {
  @Override
  public Object getAsObject(FacesContext ctx, UIComponent component, String value) {
      if (value != null) {
          return component.getAttributes().get(value);
      }
  
      return null;
  }
  
  @Override
  public String getAsString(FacesContext ctx, UIComponent component, Object obj) {
  
      if (obj instanceof String) {
          return obj.toString();
      }
  
      if (obj != null) {
          String id;
  
          try {
              id = this.getId(getClazz(ctx, component), obj);
          } catch (NoSuchFieldException | IllegalAccessException e) {
              throw new ConverterException("msg");
          }
  
          id = id.trim();
  
          component.getAttributes().put(id, getClazz(ctx, component).cast(obj));
  
          return id;
  
      }
      return null;
  }
  
  private Class&lt;?&gt; getClazz(FacesContext facesContext, UIComponent component) {
      //get entity's class
  }
  
  private String getId(Class&lt;?&gt; clazz, Object obj) throws NoSuchFieldException, IllegalAccessException {
      // get entity's ID value
  }
  
  }
  </code></pre>