Example #1
0
  public Integer getCategoryId() {
    Category category = product.getCategory();

    if (category == null) {
      return null;
    } else {
      return category.getId();
    }
  }
Example #2
0
 public void setCategoryId(Integer categoryId) {
   if (categoryId == null) {
     product.setCategory(null);
   } else {
     for (Category category : categories) {
       if (category.getId().equals(categoryId)) {
         product.setCategory(category);
         break;
       }
     }
   }
 }