@Override
  protected void modelToEntityReferences(IssueTypeDs ds, IssueType e, boolean isInsert)
      throws Exception {

    if (ds.getCategoryId() != null) {
      if (e.getCategory() == null || !e.getCategory().getId().equals(ds.getCategoryId())) {
        e.setCategory((IssueCategory) this.em.find(IssueCategory.class, ds.getCategoryId()));
      }
    } else {
      this.lookup_category_IssueCategory(ds, e);
    }
  }
  protected void lookup_category_IssueCategory(IssueTypeDs ds, IssueType e) throws Exception {
    if (ds.getCategory() != null && !ds.getCategory().equals("")) {
      IssueCategory x = null;
      try {
        x =
            ((IIssueCategoryService) findEntityService(IssueCategory.class))
                .findByName(ds.getCategory());
      } catch (javax.persistence.NoResultException exception) {
        throw new Exception(
            "Invalid value provided to find `IssueCategory` reference:  `category` = "
                + ds.getCategory()
                + "  ");
      }
      e.setCategory(x);

    } else {
      e.setCategory(null);
    }
  }