Package org.hibernate.criterion

Examples of org.hibernate.criterion.Disjunction


    DocumentBuilder<?> builder = searchFactoryImplementor.getDocumentBuilder( entityType );
    String idName = builder.getIdentifierName();
    int loop = maxResults / MAX_IN_CLAUSE;
    boolean exact = maxResults % MAX_IN_CLAUSE == 0;
    if ( !exact ) loop++;
    Disjunction disjunction = Restrictions.disjunction();
    for (int index = 0; index < loop; index++) {
      int max = index * MAX_IN_CLAUSE + MAX_IN_CLAUSE <= maxResults ?
          index * MAX_IN_CLAUSE + MAX_IN_CLAUSE :
          maxResults;
      List<Serializable> ids = new ArrayList<Serializable>( max - index * MAX_IN_CLAUSE );
      for (int entityInfoIndex = index * MAX_IN_CLAUSE; entityInfoIndex < max; entityInfoIndex++) {
        ids.add( entityInfos[entityInfoIndex].id );
      }
      disjunction.add( Restrictions.in( idName, ids ) );
    }
    criteria.add( disjunction );
    criteria.list(); //load all objects
  }
View Full Code Here


    Set<Class<?>> indexedEntities = searchFactoryImplementor.getIndexedTypesPolymorphic( new Class<?>[] { entityType } );
    DocumentBuilderIndexedEntity<?> builder = searchFactoryImplementor.getDocumentBuilderIndexedEntity(
        indexedEntities.iterator().next()
    );
    String idName = builder.getIdentifierName();
    Disjunction disjunction = Restrictions.disjunction();

    int loop = maxResults / MAX_IN_CLAUSE;
    boolean exact = maxResults % MAX_IN_CLAUSE == 0;
    if ( !exact ) {
      loop++;
    }
    for ( int index = 0; index < loop; index++ ) {
      int max = index * MAX_IN_CLAUSE + MAX_IN_CLAUSE <= maxResults ?
          index * MAX_IN_CLAUSE + MAX_IN_CLAUSE :
          maxResults;
      List<Serializable> ids = new ArrayList<Serializable>( max - index * MAX_IN_CLAUSE );
      for ( int entityInfoIndex = index * MAX_IN_CLAUSE; entityInfoIndex < max; entityInfoIndex++ ) {
        ids.add( entityInfos[entityInfoIndex].id );
      }
      disjunction.add( Restrictions.in( idName, ids ) );
    }
    criteria.add( disjunction );
    //not best effort so fail fast
    if ( timeoutManager.getType() != TimeoutManager.Type.LIMIT ) {
      Long timeLeftInSecond = timeoutManager.getTimeoutLeftInSeconds();
View Full Code Here

    {
      for(String alias: aliases)
      {
        criteria.createAlias(alias, alias);
      }
      Disjunction disjunction = Restrictions.disjunction();
      criteria.add(disjunction);
      for(String property: properties)
      {
        disjunction.add(Restrictions.ilike(property,
              searchPanel.getDefaultModelObject().toString(),
              MatchMode.ANYWHERE));
      }
    }
  }
View Full Code Here

    } catch (Exception e) {
      logger.trace("Exception", e);
    }
    if (aktuellerNutzer != null) {
      if (loginForm.getMaximaleBerechtigung() > 1) {
        Disjunction dis = Restrictions.disjunction();
        for (Projekt proj : aktuellerNutzer.getProjekteList()) {
          dis.add(Restrictions.eq("projekt", proj));
        }
        con.add(dis);
      }
    }
  }
View Full Code Here

   */
  public Criterion build(PropertyFilter filter) {
    Object value = convertMatchValue(filter.getMatchValue(), filter.getFieldType());
    Criterion criterion = null;
    if (filter.hasMultiplePropertyNames()) {
      Disjunction disjunction = Restrictions.disjunction();
      for (String propertyName:filter.getPropertyNames()) {
        disjunction.add(build(propertyName,value));
      }
      criterion = disjunction;
    } else {
      criterion = build(filter.getSinglePropertyName(),value);
    }
View Full Code Here

      /*
       * wenn die maximale Berechtigung nicht Admin ist, dann nur bestimmte
       */
      if (loginForm.getMaximaleBerechtigung() > 1) {
        Hibernate.initialize(aktuellerNutzer);
        Disjunction dis = Restrictions.disjunction();
        for (Projekt proj : aktuellerNutzer.getProjekteList()) {
          dis.add(Restrictions.eq("projekt", proj));
        }
        crit.add(dis);
      }
    }

View Full Code Here

      if (this.hideInactiveUsers) {
        crit.add(Restrictions.eq("istAktiv", true));
      }

      if (this.filter != null || this.filter.length() != 0) {
        Disjunction ex = Restrictions.disjunction();
        ex.add(Restrictions.like("vorname", "%" + this.filter + "%"));
        ex.add(Restrictions.like("nachname", "%" + this.filter + "%"));
//        crit.createCriteria("projekte", "proj");
//        ex.add(Restrictions.like("proj.titel", "%" + this.filter + "%"));
       
//        crit.createCriteria("benutzergruppen", "group");
//        ex.add(Restrictions.like("group.titel", "%" + this.filter + "%"));
View Full Code Here

    Set<Class<?>> indexedEntities = searchFactoryImplementor.getIndexedTypesPolymorphic( new Class<?>[] { entityType } );
    DocumentBuilderIndexedEntity<?> builder = searchFactoryImplementor.getDocumentBuilderIndexedEntity(
        indexedEntities.iterator().next()
    );
    String idName = builder.getIdentifierName();
    Disjunction disjunction = Restrictions.disjunction();

    int loop = maxResults / MAX_IN_CLAUSE;
    boolean exact = maxResults % MAX_IN_CLAUSE == 0;
    if ( !exact ) {
      loop++;
    }
    for ( int index = 0; index < loop; index++ ) {
      int max = index * MAX_IN_CLAUSE + MAX_IN_CLAUSE <= maxResults ?
          index * MAX_IN_CLAUSE + MAX_IN_CLAUSE :
          maxResults;
      List<Serializable> ids = new ArrayList<Serializable>( max - index * MAX_IN_CLAUSE );
      for ( int entityInfoIndex = index * MAX_IN_CLAUSE; entityInfoIndex < max; entityInfoIndex++ ) {
        ids.add( entityInfos[entityInfoIndex].getId() );
      }
      disjunction.add( Restrictions.in( idName, ids ) );
    }
    criteria.add( disjunction );
    //not best effort so fail fast
    if ( timeoutManager.getType() != TimeoutManager.Type.LIMIT ) {
      Long timeLeftInSecond = timeoutManager.getTimeoutLeftInSeconds();
View Full Code Here

    Set<Class<?>> indexedEntities = searchFactoryImplementor.getIndexedTypesPolymorphic( new Class<?>[] { entityType } );
    DocumentBuilderIndexedEntity<?> builder = searchFactoryImplementor.getIndexBinding(
        indexedEntities.iterator().next()
    ).getDocumentBuilder();
    String idName = builder.getIdentifierName();
    Disjunction disjunction = Restrictions.disjunction();

    int loop = maxResults / MAX_IN_CLAUSE;
    boolean exact = maxResults % MAX_IN_CLAUSE == 0;
    if ( !exact ) {
      loop++;
    }
    for ( int index = 0; index < loop; index++ ) {
      int max = index * MAX_IN_CLAUSE + MAX_IN_CLAUSE <= maxResults ?
          index * MAX_IN_CLAUSE + MAX_IN_CLAUSE :
          maxResults;
      List<Serializable> ids = new ArrayList<Serializable>( max - index * MAX_IN_CLAUSE );
      for ( int entityInfoIndex = index * MAX_IN_CLAUSE; entityInfoIndex < max; entityInfoIndex++ ) {
        ids.add( entityInfos[entityInfoIndex].getId() );
      }
      disjunction.add( Restrictions.in( idName, ids ) );
    }
    criteria.add( disjunction );
    //not best effort so fail fast
    if ( timeoutManager.getType() != TimeoutManager.Type.LIMIT ) {
      Long timeLeftInSecond = timeoutManager.getTimeoutLeftInSeconds();
View Full Code Here

            transaction = this.session.beginTransaction();
            Criteria crit = this.session.createCriteria(Annonce.class);
            crit.add(Restrictions.eq("statut", dao.getById(1)));
            crit.addOrder(Order.desc("id"));
           
            Disjunction disDeps = Restrictions.disjunction();
           
            for(Departement dept : depts){
                disDeps.add(Restrictions.eq("departement",dept));
            }
           
            crit.add(disDeps);
                     
            annonces = new HashSet<Annonce>(
View Full Code Here

TOP

Related Classes of org.hibernate.criterion.Disjunction

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.