I solved it by implementing another converter which extends EntityConverter and checks if the ID is null. Thats my code like:
@FacesConverter(value = "anotherConverter")
public class AnotherConverter extends EntityConverter {
@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
if (value instanceof Document && ((Document) value).getId() == null) {
return String.valueOf(((Document) value).hashCode());
}
return super.getAsString(context, component, value);
}
}