Package org.hibernate.criterion

Examples of org.hibernate.criterion.DetachedCriteria


    return (User) getHibernateTemplate().save(user);
  }

  @SuppressWarnings("unchecked")
  public User findUser(String name, String password) {
    DetachedCriteria criteria = DetachedCriteria.forClass(User.class);
    criteria.add(Restrictions.and(Restrictions.eq("name", name),
        Restrictions.eq("password", password)));
    List<User> users = getHibernateTemplate().findByCriteria(criteria);
    if (users.isEmpty())
      return null;
    else
View Full Code Here


        List<ProductSku> productSkus = criteria.list();
        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);
        criteria.add(Subqueries.notIn("id", subquery));
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  @Override
  public List<CountryCode> getAllCountryCodes() {
    DetachedCriteria criteria = DetachedCriteria.forClass(CountryCode.class);
    criteria.addOrder(Order.asc("ccdName"));

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

  }

  @SuppressWarnings("unchecked")
  @Override
  public CountryCode getCountryCodeByCode2(String code2) {
    DetachedCriteria criteria = DetachedCriteria.forClass(CountryCode.class);
    criteria.add(Restrictions.eq("ccdCode2", code2));

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

  }

  @SuppressWarnings("unchecked")
  @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

  @SuppressWarnings("unchecked")
  @Override
  public List<SecRole> getRolesLikeRoleName(String aRoleName) {

    DetachedCriteria criteria = DetachedCriteria.forClass(SecRole.class);
    criteria.add(Restrictions.ilike("rolShortdescription", aRoleName, MatchMode.ANYWHERE));

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

  @SuppressWarnings("unchecked")
  @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

    return getHibernateTemplate().loadAll(SecGroupright.class);
  }

  @Override
  public boolean isRightInGroup(SecRight right, SecGroup group) {
    DetachedCriteria criteria = DetachedCriteria.forClass(SecGroupright.class);
    criteria.add(Restrictions.eq("secGroup", group));
    criteria.add(Restrictions.eq("secRight", right));
    criteria.setProjection(Projections.rowCount());

    int count = DataAccessUtils.intResult(getHibernateTemplate().findByCriteria(criteria));
    return count > 0;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public SecGroupright getGroupRightByGroupAndRight(SecGroup group, SecRight right) {

    DetachedCriteria criteria = DetachedCriteria.forClass(SecGroupright.class);
    criteria.add(Restrictions.eq("secGroup", group));
    criteria.add(Restrictions.eq("secRight", right));

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

  @SuppressWarnings("unchecked")
  @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

TOP

Related Classes of org.hibernate.criterion.DetachedCriteria

Copyright © 2018 www.massapicom. 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.