@Override
 public long countDuplicate(SystemCodes code) {
   String queryString = getJpqlQuery("jpql.systemcodes.countDuplicate");
   Query queryObject = getEntityManager().createQuery(queryString);
   queryObject.setParameter("keyName", code.getKey());
   // if id is null it means it is a new systemCodes
   if (code.getId() == null) {
     queryObject.setParameter("id", 0l);
   } else {
     queryObject.setParameter("id", code.getId());
   }
   return (Long) queryObject.getSingleResult();
 }
 /* (non-Javadoc)
  * @see org.opentides.persistence.impl.BaseEntityDAOJpaImpl#appendOrderToExample(org.opentides.bean.BaseEntity)
  */
 @Override
 protected String appendOrderToExample(SystemCodes example) {
   if (StringUtil.isEmpty(example.getOrderOption())) return "order by obj.value asc";
   else return super.appendOrderToExample(example);
 }
 /** Retrieves SystemCodes for the given category */
 public List<SystemCodes> findSystemCodesByCategory(String category) {
   SystemCodes example = new SystemCodes();
   example.setCategory(category);
   return findByExample(example, true);
 }