Package org.hibernate.criterion

Examples of org.hibernate.criterion.DetachedCriteria.createAlias()


                    String innerClass = field.split("\\.")[0].trim();
                    String innerAttribute = field.split("\\.")[1].trim();
                    log.debug("Adicionando resultado da consulta por ordem do campo "+innerClass+"."+innerAttribute+" COM criação de alias");
                    if (sortOrder) {
                        log.debug("Ordenação adicionada: " + sortField + " ASC");
                        criteria.createAlias(innerClass, innerClass).addOrder(Order.asc(innerClass+"."+innerAttribute));
                    } else {
                        log.debug("Ordenação adicionada: " + sortField + " DESC");
                        criteria.createAlias(innerClass, innerClass).addOrder(Order.desc(innerClass+"."+innerAttribute));
                    }
                }
View Full Code Here


                    if (sortOrder) {
                        log.debug("Ordenação adicionada: " + sortField + " ASC");
                        criteria.createAlias(innerClass, innerClass).addOrder(Order.asc(innerClass+"."+innerAttribute));
                    } else {
                        log.debug("Ordenação adicionada: " + sortField + " DESC");
                        criteria.createAlias(innerClass, innerClass).addOrder(Order.desc(innerClass+"."+innerAttribute));
                    }
                }

            }
View Full Code Here

        return productSkus;
    }

    public List<ProductSku> findProductSkusNotInThisMasterCatalogCategoryId(final Long categoryId, Object... params) {
        DetachedCriteria subquery = DetachedCriteria.forClass(ProductSku.class);
        subquery.createAlias("catalogCategoryMasterProductSkuRels", "catalogCategoryProductSkuRel", JoinType.LEFT_OUTER_JOIN);
        subquery.add(Restrictions.eq("catalogCategoryProductSkuRel.pk.catalogCategoryMaster.id", categoryId));
        subquery.setProjection(Projections.property("id"));

        Criteria criteria = createDefaultCriteria(ProductSku.class);
        handleSpecificProductMarketingFetchMode(criteria, params);
View Full Code Here

  @Override
  public List<SecRole> getRolesByUser(SecUser aUser) {
    DetachedCriteria criteria = DetachedCriteria.forClass(SecRole.class);

    // Aliases are working only on properties
    criteria.createAlias("secUserroles", "rol");
    criteria.add(Restrictions.eq("rol.secUser", aUser));

    return getHibernateTemplate().findByCriteria(criteria);
  }
View Full Code Here

  @Override
  public List<SecRight> getRightsByGroup(SecGroup group) {

    DetachedCriteria criteria = DetachedCriteria.forClass(SecRight.class);
    // Aliases are working only on properties they build the JOINS
    criteria.createAlias("secGrouprights", "gr");
    criteria.add(Restrictions.eq("gr.secGroup", group));

    return getHibernateTemplate().findByCriteria(criteria);
  }
View Full Code Here

  @Override
  public List<SecRight> getGroupRightsByGroup(SecGroup group) {

    DetachedCriteria criteria = DetachedCriteria.forClass(SecRight.class);
    // Aliases only for properties
    criteria.createAlias("secGrouprights", "gr");
    criteria.add(Restrictions.eq("gr.secGroup", group));

    return getHibernateTemplate().findByCriteria(criteria);

  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public SecGroup getGroupByGroupRight(SecGroupright secGroupright) {
    DetachedCriteria criteria = DetachedCriteria.forClass(SecGroup.class);
    // Aliases are working only on properties
    criteria.createAlias("secGrouprights", "gr");
    criteria.add(Restrictions.eq("gr.id", Long.valueOf(secGroupright.getId())));

    return (SecGroup) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public SecGroup getGroupByRolegroup(SecRolegroup secRolegroup) {
    DetachedCriteria criteria = DetachedCriteria.forClass(SecGroup.class);
    // Aliases are working only on properties
    criteria.createAlias("secRolegroups", "rg");
    criteria.add(Restrictions.eq("rg.id", Long.valueOf(secRolegroup.getId())));

    return (SecGroup) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public List<SecGroup> getGroupsByUser(SecUser aUser) {
    DetachedCriteria criteria = DetachedCriteria.forClass(SecGroup.class);
    // Aliases are working only on properties
    criteria.createAlias("secRolegroups", "rg");
    criteria.createAlias("secRoles", "rol");
    criteria.add(Restrictions.eq("rg.rol.secUser", aUser));

    return getHibernateTemplate().findByCriteria(criteria);
  }
View Full Code Here

  @Override
  public List<SecGroup> getGroupsByUser(SecUser aUser) {
    DetachedCriteria criteria = DetachedCriteria.forClass(SecGroup.class);
    // Aliases are working only on properties
    criteria.createAlias("secRolegroups", "rg");
    criteria.createAlias("secRoles", "rol");
    criteria.add(Restrictions.eq("rg.rol.secUser", aUser));

    return getHibernateTemplate().findByCriteria(criteria);
  }
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.