public List<Category> getAllCategories(MappingSetup setup) {
   if (getCount() == 0) {
     return new ArrayList<Category>();
   } else {
     DetachedCriteria criteria = super.getCriterion();
     criteria.add(Restrictions.eq(Category.Field.MAPPING_SETUP.getFieldName(), setup));
     return super.getList(criteria);
   }
 }
 /**
  * Retrieves the category whose unique id on the frontend is the one in @param serverId
  *
  * @param serverId Unique id of the category on the frontend
  * @return {@link Category}
  */
 public Category findCategory(long serverId, MappingSetup setup) {
   if (getCount() == 0) {
     return null;
   } else {
     DetachedCriteria criteria = super.getCriterion();
     criteria.add(Restrictions.eq(Category.Field.SERVER_ID.getFieldName(), new Long(serverId)));
     criteria.add(Restrictions.eq(Category.Field.MAPPING_SETUP.getFieldName(), setup));
     return super.getUnique(criteria);
   }
 }