예제 #1
0
  public CatalogMaster getMasterCatalogById(final Long masterCatalogId, Object... params) {
    Criteria criteria = createDefaultCriteria(CatalogMaster.class);

    FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params);

    criteria.add(Restrictions.eq("id", masterCatalogId));

    CatalogMaster catalogMaster = (CatalogMaster) criteria.uniqueResult();
    if (catalogMaster != null) {
      catalogMaster.setFetchPlan(fetchPlan);
    }
    return catalogMaster;
  }
예제 #2
0
 public CatalogMaster saveOrUpdateCatalogMaster(final CatalogMaster catalogMaster) {
   if (catalogMaster.getDateCreate() == null) {
     catalogMaster.setDateCreate(new Date());
   }
   catalogMaster.setDateUpdate(new Date());
   if (catalogMaster.getId() != null) {
     if (em.contains(catalogMaster)) {
       em.refresh(catalogMaster);
     }
     CatalogMaster mergedCatalogMaster = em.merge(catalogMaster);
     em.flush();
     return mergedCatalogMaster;
   } else {
     em.persist(catalogMaster);
     return catalogMaster;
   }
 }