Package org.hibernate.criterion

Examples of org.hibernate.criterion.DetachedCriteria


  }

  @SuppressWarnings("unchecked")
  @Override
  public ResultObject getAllBranches(int start, int pageSize) {
    DetachedCriteria criteria = DetachedCriteria.forClass(Branche.class);
    criteria.addOrder(Order.asc("braBezeichnung"));

    int totalCount = getHibernateTemplate().findByCriteria(criteria).size();

    List<Branche> list = getHibernateTemplate().findByCriteria(criteria, start, pageSize);
View Full Code Here


  }

  @SuppressWarnings("unchecked")
  @Override
  public ResultObject getAllBranchesLikeText(String text, int start, int pageSize) {
    DetachedCriteria criteria = DetachedCriteria.forClass(Branche.class);

    if (!StringUtils.isEmpty(text)) {
      criteria.add(Restrictions.ilike("braBezeichnung", text, MatchMode.ANYWHERE));
    }

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

    int totalCount = getHibernateTemplate().findByCriteria(criteria).size();

    List<Branche> list = getHibernateTemplate().findByCriteria(criteria, start, pageSize);
View Full Code Here

    return get(Office.class, fil_Id);
  }

  @SuppressWarnings("unchecked")
  public Office getOfficeByFilNr(String fil_nr) {
    DetachedCriteria criteria = DetachedCriteria.forClass(Office.class);
    criteria.add(Restrictions.eq("filNr", fil_nr));

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

  @SuppressWarnings("unchecked")
  @Override
  public List<Office> getOfficesLikeCity(String string) {

    DetachedCriteria criteria = DetachedCriteria.forClass(Office.class);
    criteria.add(Restrictions.ilike("filOrt", string, MatchMode.ANYWHERE));

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

  @SuppressWarnings("unchecked")
  @Override
  public List<Office> getOfficesLikeName1(String string) {

    DetachedCriteria criteria = DetachedCriteria.forClass(Office.class);
    criteria.add(Restrictions.ilike("filName1", string, MatchMode.ANYWHERE));

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

  @SuppressWarnings("unchecked")
  @Override
  public List<Office> getOfficesLikeNo(String string) {

    DetachedCriteria criteria = DetachedCriteria.forClass(Office.class);
    criteria.add(Restrictions.ilike("filNr", string, MatchMode.ANYWHERE));

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

  @SuppressWarnings("unchecked")
  @Override
  public List<SecGroup> getGroupsByRole(SecRole aRole) {

    DetachedCriteria criteria = DetachedCriteria.forClass(SecGroup.class);

    // Aliases are working only on properties
    criteria.createAlias("secRolegroups", "rg");
    criteria.add(Restrictions.eq("rg.secRole", aRole));

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

  }

  @SuppressWarnings("unchecked")
  @Override
  public SecRolegroup getRolegroupByRoleAndGroup(SecRole aRole, SecGroup aGroup) {
    DetachedCriteria criteria = DetachedCriteria.forClass(SecRolegroup.class);
    criteria.add(Restrictions.eq("secRole", aRole));
    criteria.add(Restrictions.eq("secGroup", aGroup));

    return (SecRolegroup) DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));

  }
View Full Code Here

  }

  @Override
  public boolean isGroupInRole(SecGroup aGroup, SecRole aRole) {
    DetachedCriteria criteria = DetachedCriteria.forClass(SecRolegroup.class);
    criteria.add(Restrictions.eq("secGroup", aGroup));
    criteria.add(Restrictions.eq("secRole", aRole));
    criteria.setProjection(Projections.rowCount());

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

  @SuppressWarnings("unchecked")
  @Override
  public Article getArticleByNumber(String artNumber) {

    DetachedCriteria criteria = DetachedCriteria.forClass(Article.class);
    criteria.add(Restrictions.eq("artNr", artNumber));

    return (Article) DataAccessUtils.uniqueResult(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.