public CatalogVirtual getVirtualCatalogById(final Long virtualCatalogId, Object... params) { Criteria criteria = createDefaultCriteria(CatalogVirtual.class); FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params); criteria.add(Restrictions.eq("id", virtualCatalogId)); CatalogVirtual catalogVirtual = (CatalogVirtual) criteria.uniqueResult(); if (catalogVirtual != null) { catalogVirtual.setFetchPlan(fetchPlan); } return catalogVirtual; }
public CatalogVirtual getVirtualCatalogByMarketAreaId(final Long marketAreaId, Object... params) { Criteria criteria = createDefaultCriteria(CatalogVirtual.class); FetchPlan fetchPlan = handleSpecificFetchMode(criteria, params); criteria.setFetchMode("catalogMaster", FetchMode.JOIN); criteria.createAlias("marketArea", "marketArea", JoinType.LEFT_OUTER_JOIN); criteria.add(Restrictions.eq("marketArea.id", marketAreaId)); CatalogVirtual catalogVirtual = (CatalogVirtual) criteria.uniqueResult(); if (catalogVirtual != null) { catalogVirtual.setFetchPlan(fetchPlan); } return catalogVirtual; }