Exemplo n.º 1
0
  public Tax getTaxByCode(final String taxCode, Object... params) {
    Criteria criteria = createDefaultCriteria(Tax.class);

    FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params);

    criteria.add(Restrictions.eq("code", taxCode));
    Tax tax = (Tax) criteria.uniqueResult();
    if (tax != null) {
      tax.setFetchPlan(fetchPlan);
    }
    return tax;
  }
Exemplo n.º 2
0
 public Tax saveOrUpdateTax(final Tax tax) {
   if (tax.getId() != null) {
     if (em.contains(tax)) {
       em.refresh(tax);
     }
     Tax mergedTax = em.merge(tax);
     em.flush();
     return mergedTax;
   } else {
     em.persist(tax);
     return tax;
   }
 }