Package org.hibernate.criterion

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


  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


  public List<Order> getOrdersByOffice(Office office) {
    DetachedCriteria criteria = DetachedCriteria.forClass(Order.class);

    // Raussuchen bei welchen Auftraegen der zugehoerige Kunde bei der
    // angegebenen Filiale ist
    criteria.createAlias("customer", "cu");
    criteria.add(Restrictions.eq("cu.office", office));

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

  @Override
  public List<SecRight> getRightsByGroupright(SecGroupright secGroupright) {

    final DetachedCriteria criteria = DetachedCriteria.forClass(SecRight.class);
    // Aliases only for properties
    criteria.createAlias("secGrouprights", "gr");
    criteria.add(Restrictions.eq("gr.id", Long.valueOf(secGroupright.getId())));

    return getHibernateTemplate().findByCriteria(criteria);

  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public Customer getCustomerByOrder(de.forsthaus.backend.model.Order order) {
    DetachedCriteria criteria = DetachedCriteria.forClass(Customer.class);

    criteria.createAlias("orders", "au");
    criteria.add(Restrictions.eq("au.id", Long.valueOf(order.getId())));

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

    DetachedCriteria criteria = DetachedCriteria.forClass(Conto.class);
    Conjunction conj = Restrictions.conjunction();
    conj.add(Restrictions.eq("pianoDeiConti.codiceConto", codiceConto));
    conj.add(Restrictions.eq("mastro.flagPartitario", flagPartitario));
    criteria.add(conj);
    criteria.createAlias("mastro", "mastro");
    List<Conto> listaContiTrovati = null;
    try {
      listaContiTrovati = (List<Conto>) getHibernateTemplate().findByCriteria(criteria);
    } catch (DataAccessException e) {
      log("Impossibile Cercare Conto [CODICE] " + codiceConto + " con flagPartitario : " + flagPartitario);
View Full Code Here

  @SuppressWarnings("unchecked")
  public List<Conto> cercaContoMastroByCriteria(List<SearchCriteriaLogicProduct> andCriteriaList)
      throws ImpossibileCercareContoException {
    DetachedCriteria criteria = SearchUtils.getDetachedCriteria(andCriteriaList, "contoId.legalEntity",
        legalEntity, "contoId.organizationUnit", organizationUnit, Conto.class);
    criteria.createAlias("mastro", "mastro");
    try {
      return (List<Conto>) getHibernateTemplate().findByCriteria(criteria);
    } catch (DataAccessException e) {
      log("Impossibile Cercare Conto Mastro:" + e);
      throw new ImpossibileCercareContoException();
View Full Code Here

  @SuppressWarnings("unchecked")
  public PagedSearchResult pagedCercaContoMastroByCriteria(List<SearchCriteriaLogicProduct> andCriteriaList,
      int startingIndex, int pageSize) throws ImpossibileCercareContoException {
    DetachedCriteria criteria = SearchUtils.getDetachedCriteriaWithIgnoreCase(andCriteriaList,
        "contoId.legalEntity", legalEntity, "contoId.organizationUnit", organizationUnit, Conto.class);
    criteria.createAlias("mastro", "mastro");
    try {
      List<Object> result = getHibernateTemplate().findByCriteria(criteria, startingIndex, pageSize + 1);
      return PagedSearchResult.makePagedSearchResult(result, pageSize);
    } catch (DataAccessException e) {
      log("Impossibile Cercare Conto Mastro:" + e);
View Full Code Here

        if (activeConsumers == null || activeConsumers.isEmpty()) {
            return new ArrayList<Compliance>();
        }

        DetachedCriteria mainQuery = DetachedCriteria.forClass(Compliance.class);
        mainQuery.createAlias("consumer", "c");
        mainQuery.add(Restrictions.in("c.uuid", activeConsumers));

        if (ownerFilters != null && !ownerFilters.isEmpty()) {
            mainQuery.createAlias("c.owner", "o");
            mainQuery.add(Restrictions.in("o.key", ownerFilters));
View Full Code Here

        DetachedCriteria mainQuery = DetachedCriteria.forClass(Compliance.class);
        mainQuery.createAlias("consumer", "c");
        mainQuery.add(Restrictions.in("c.uuid", activeConsumers));

        if (ownerFilters != null && !ownerFilters.isEmpty()) {
            mainQuery.createAlias("c.owner", "o");
            mainQuery.add(Restrictions.in("o.key", ownerFilters));
        }

        Date toCheck = targetDate == null ? new Date() : targetDate;
        mainQuery.add(Restrictions.le("date", toCheck));
View Full Code Here

    Map<String, String> subargs = childargs.get(type);
    logger.debug( "child type {}", type );

    for( String key: subargs.keySet()){
      DetachedCriteria propCriteria = subquery.createCriteria("properties");
      propCriteria.createAlias("type", "t").add(Restrictions.eq("t.name", key)).
      createAlias("valuelist", "vl").
            add(Restrictions.eq("nextRevision",Modification.MaxRevision)).
            createAlias("vl.values", "v").
              add(Restrictions.like("v.svalue", subargs.get(key)).ignoreCase());  
      logger.debug( "  {} --> {}",key, subargs.get(key));
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.