Package org.hibernate

Examples of org.hibernate.Criteria.createAlias()


   
    public List<ProductSku> findProductSkusByStoreId(final Long storeId, Object... params) {
        Criteria criteria = createDefaultCriteria(ProductSku.class);
        handleSpecificProductMarketingFetchMode(criteria, params);

        criteria.createAlias("stores", "stores", JoinType.LEFT_OUTER_JOIN);
        criteria.add(Restrictions.eq("stores.id", storeId));

        criteria.addOrder(Order.asc("id"));

        @SuppressWarnings("unchecked")
View Full Code Here


   
    public List<ProductBrand> findProductBrandsByCatalogCategoryCode(final String categoryCode, Object... params) {
        Criteria criteria = getSession().createCriteria(ProductBrand.class);
        handleSpecificProductBrandFetchMode(criteria, params);
       
        criteria.createAlias("productMarketings", "productMarketing", JoinType.LEFT_OUTER_JOIN);
        criteria.createAlias("productMarketing.productSkus", "productSku", JoinType.LEFT_OUTER_JOIN);
        criteria.setFetchMode("productSku.defaultCatalogCategory", FetchMode.JOIN);
        criteria.createAlias("productSku.defaultCatalogCategory", "defaultCatalogCategory", JoinType.LEFT_OUTER_JOIN);
       
        criteria.add(Restrictions.eq("defaultCatalogCategory.code", handleCodeValue(categoryCode)));
View Full Code Here

    public List<ProductBrand> findProductBrandsByCatalogCategoryCode(final String categoryCode, Object... params) {
        Criteria criteria = getSession().createCriteria(ProductBrand.class);
        handleSpecificProductBrandFetchMode(criteria, params);
       
        criteria.createAlias("productMarketings", "productMarketing", JoinType.LEFT_OUTER_JOIN);
        criteria.createAlias("productMarketing.productSkus", "productSku", JoinType.LEFT_OUTER_JOIN);
        criteria.setFetchMode("productSku.defaultCatalogCategory", FetchMode.JOIN);
        criteria.createAlias("productSku.defaultCatalogCategory", "defaultCatalogCategory", JoinType.LEFT_OUTER_JOIN);
       
        criteria.add(Restrictions.eq("defaultCatalogCategory.code", handleCodeValue(categoryCode)));
View Full Code Here

        handleSpecificProductBrandFetchMode(criteria, params);
       
        criteria.createAlias("productMarketings", "productMarketing", JoinType.LEFT_OUTER_JOIN);
        criteria.createAlias("productMarketing.productSkus", "productSku", JoinType.LEFT_OUTER_JOIN);
        criteria.setFetchMode("productSku.defaultCatalogCategory", FetchMode.JOIN);
        criteria.createAlias("productSku.defaultCatalogCategory", "defaultCatalogCategory", JoinType.LEFT_OUTER_JOIN);
       
        criteria.add(Restrictions.eq("defaultCatalogCategory.code", handleCodeValue(categoryCode)));

       
        @SuppressWarnings("unchecked")
View Full Code Here

       
        FetchPlan fetchPlan = handleSpecificFetchMasterCategoryMode(criteria, params);

        criteria.add(Restrictions.eq("code", handleCodeValue(catalogCategoryCode)));
       
        criteria.createAlias("catalog", "catalog", JoinType.LEFT_OUTER_JOIN);
        criteria.add(Restrictions.eq("catalog.code", handleCodeValue(catalogMasterCode)));
       
        CatalogCategoryMaster catalogCategory = (CatalogCategoryMaster) criteria.uniqueResult();
        if(catalogCategory != null){
            catalogCategory.setFetchPlan(fetchPlan);
View Full Code Here

 
  public List<CatalogCategoryMaster> findRootMasterCatalogCategoriesByCatalogCode(final String catalogMasterCode, Object... params) {
        Criteria criteria = createDefaultCriteria(CatalogCategoryMaster.class);
        handleSpecificFetchMasterCategoryMode(criteria, params);
       
        criteria.createAlias("catalog", "catalog", JoinType.LEFT_OUTER_JOIN);
        criteria.add(Restrictions.eq("catalog.code", handleCodeValue(catalogMasterCode)));
        criteria.add(Restrictions.isNull("parentCatalogCategory"));
        criteria.addOrder(Order.asc("id"));

        @SuppressWarnings("unchecked")
View Full Code Here

 
    public List<CatalogCategoryMaster> findAllMasterCatalogCategoriesByCatalogCode(final String catalogMasterCode, Object... params) {
        Criteria criteria = createDefaultCriteria(CatalogCategoryMaster.class);
        handleSpecificFetchMasterCategoryMode(criteria, params);
       
        criteria.createAlias("catalog", "catalog", JoinType.LEFT_OUTER_JOIN);
        criteria.add(Restrictions.eq("catalog.code", handleCodeValue(catalogMasterCode)));
        criteria.addOrder(Order.asc("id"));

        @SuppressWarnings("unchecked")
        List<CatalogCategoryMaster> categories = criteria.list();
View Full Code Here

    public List<CatalogCategoryMaster> findMasterCategoriesByProductSkuId(final Long productSkuId, Object... params) {
        Criteria criteria = createDefaultCriteria(CatalogCategoryMaster.class);

        handleSpecificFetchVirtualCategoryMode(criteria, params);
       
        criteria.createAlias("catalogCategoryProductSkuRels", "catalogCategoryProductSkuRel", JoinType.LEFT_OUTER_JOIN);
        criteria.add(Restrictions.eq("catalogCategoryProductSkuRel.pk.productSku.id", productSkuId));

        criteria.addOrder(Order.asc("id"));

        @SuppressWarnings("unchecked")
View Full Code Here

  public CatalogCategoryVirtual getVirtualCatalogCategoryByVirtualCategoryCode(final String catalogCategoryCode, final String catalogVirtualCode, Object... params) {
        Criteria criteria = createDefaultCriteria(CatalogCategoryVirtual.class);
       
        FetchPlan fetchPlan = handleSpecificFetchVirtualCategoryMode(criteria, params);

        criteria.createAlias("catalog", "catalog", JoinType.LEFT_OUTER_JOIN);
        criteria.add(Restrictions.eq("catalog.code", handleCodeValue(catalogCategoryCode)));
       
        criteria.add(Restrictions.eq("code", handleCodeValue(catalogCategoryCode)));

        CatalogCategoryVirtual catalogCategory = (CatalogCategoryVirtual) criteria.uniqueResult();
View Full Code Here

    public CatalogCategoryVirtual getVirtualCatalogCategoryByMasterCategoryCode(final String catalogCategoryCode, final String catalogVirtualCode, final String catalogMasterCode, Object... params) {
        Criteria criteria = createDefaultCriteria(CatalogCategoryVirtual.class);
       
        FetchPlan fetchPlan = handleSpecificFetchVirtualCategoryMode(criteria, params);

        criteria.createAlias("catalog", "catalog", JoinType.LEFT_OUTER_JOIN);
        criteria.add(Restrictions.eq("catalog.code", handleCodeValue(catalogVirtualCode)));

        criteria.createAlias("categoryMaster", "categoryMaster", JoinType.LEFT_OUTER_JOIN);
        criteria.add(Restrictions.eq("categoryMaster.code", handleCodeValue(catalogCategoryCode)));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.