Package org.hibernate.criterion

Examples of org.hibernate.criterion.ProjectionList


   * @throws IllegalAccessException
   * @throws Exception
   */
  public static ProjectionList projectionSupport(Criteria criteria,
      ProjectionList projectionList) throws Exception {
    ProjectionList newProjectionList = Projections.projectionList();
    Map<String, String> aliasesToCreate = new HashMap<String, String>();
    for (int i = 0; i < projectionList.getLength(); i++) {
      Projection projection = projectionList.getProjection(i);
      String projectionString = projection.toString();
      if (projectionString.indexOf(".") != -1) {
        String[] splitedString = projectionString.split("\\.");
        createAlias(criteria, splitedString);
        newProjectionList.add(Projections.property(splitedString[splitedString.length-2]+"."+splitedString[splitedString.length-1]));
      } else {
        newProjectionList.add(projection);
      }
    }
    return newProjectionList;
  }
View Full Code Here


      String[] projections, String columnOrder, String columnOrderDir,
      int startIndex) throws Exception {
    AcademyService academyService = (AcademyService) BusinessUtil
        .findBusiness("AcademyService");

    ProjectionList projectionList = Projections.projectionList();
    for (int i = 0; i < projections.length; i++) {
      projectionList.add(Projections.property(projections[i]));
    }
    List<Criterion> criterions = new ArrayList<Criterion>();

    FiltersUtil filtersUtil = new FiltersUtil();
    criterions = filtersUtil.createCriteriaFromFilters(filters,
View Full Code Here

        orders.add(Order.asc(columnOrder));
      }
    }
   

    ProjectionList projectionList = Projections.projectionList();
    for (int i = 0; i < projections.length; i++) {
      projectionList.add(Projections.property(projections[i]));
    }
    List<Criterion> criterions = new ArrayList<Criterion>();
    startIndex = (startIndex - 1) * ROW_AMOUNT;
    DataResult dataResult=null;
   
View Full Code Here

    return listOrders;
  }

  @Override
  public ProjectionList setProjections() {
    ProjectionList listProjections = Projections.projectionList();
    listProjections.add(Projections.distinct(Projections.property(Pracownik.PROPERTY_NAZWISKO)));
    return listProjections;
  }
View Full Code Here

    return listOrders;
  }

  @Override
  public ProjectionList setProjections() {
    ProjectionList listProjections = Projections.projectionList();
    listProjections.add(Projections.property(Stanowisko.PROPERTY_ID));
    listProjections.add(Projections.property(Stanowisko.PROPERTY_OBJECT_PPRACOWNIKS+"."+Pracownik.PROPERTY_IMIE));
    listProjections.add(Projections.property(Stanowisko.PROPERTY_OBJECT_PPRACOWNIKS+"."+Pracownik.PROPERTY_OBJECT_DZIALS+"."+Dzial.PROPERTY_NAZWA_DZIALU));
    return listProjections;
  }
View Full Code Here

   * @throws IllegalAccessException
   * @throws Exception
   */
  public static ProjectionList projectionSupport(Criteria criteria,
      ProjectionList projectionList) throws Exception {
    ProjectionList newProjectionList = Projections.projectionList();
    Map<String, String> aliasesToCreate = new HashMap<String, String>();
    for (int i = 0; i < projectionList.getLength(); i++) {
      Projection projection = projectionList.getProjection(i);
      String projectionString = projection.toString();
      if (projectionString.indexOf(".") != -1) {
        String[] splitedString = projectionString.split("\\.");
        createAlias(criteria, splitedString);
        newProjectionList.add(Projections.property(splitedString[splitedString.length-2]+"."+splitedString[splitedString.length-1]));
      } else {
        newProjectionList.add(projection);
      }
    }
    return newProjectionList;
  }
View Full Code Here

    return result;

  }
  @Override
  public ProjectionList setProjections() {
    ProjectionList listProjections = Projections.projectionList();
    listProjections.add(Projections.property(Dzial.PROPERTY_ID));
    listProjections.add(Projections.property(Dzial.PROPERTY_OBJECT_PRACOWNIKS+"."+Pracownik.PROPERTY_IMIE));
    listProjections.add(Projections.property(Dzial.PROPERTY_OBJECT_PRACOWNIKS+"."+Pracownik.PROPERTY_OBJECT_STANOWSKO+"."+Stanowisko.PROPERTY_NAZWA));
    return listProjections;
  }
View Full Code Here

      String[] projections, String columnOrder, String columnOrderDir,
      int startIndex) throws Exception {
    StudentGuardianService studentGuardianService = (StudentGuardianService) BusinessUtil
        .findBusiness("StudentGuardianService");

    ProjectionList projectionList = Projections.projectionList();
    for (int i = 0; i < projections.length; i++) {
      projectionList.add(Projections.property(projections[i]));
    }
    List<Criterion> criterions = new ArrayList<Criterion>();

    FiltersUtil filtersUtil = new FiltersUtil();
    criterions = filtersUtil
View Full Code Here

    pracownikService.load(generatedId);
  }

  @Test
  public void findByParamsProjections() throws Exception{
    ProjectionList list = Projections.projectionList();
    list.add(Projections.property(Pracownik.PROPERTY_ID));
    list.add(Projections.property(Pracownik.PROPERTY_OBJECT_DZIALS+"."+Dzial.PROPERTY_NAZWA_DZIALU));
    pracownikService.findByParams(list);
  }
View Full Code Here

    }
  }
 
  @Test
  public void findByParamsProjectionsCriteria() throws Exception{
    ProjectionList listProjections = Projections.projectionList();
    listProjections.add(Projections.property(Pracownik.PROPERTY_ID));
    listProjections.add(Projections.property(Pracownik.PROPERTY_OBJECT_DZIALS+"."+Dzial.PROPERTY_NAZWA_DZIALU));
   
    List<Criterion> listCriterions = new ArrayList<Criterion>();
    listCriterions.add(Restrictions.isNotNull(Pracownik.PROPERTY_ID));
    listCriterions.add(Restrictions.isNotNull(Pracownik.PROPERTY_OBJECT_DZIALS+"."+Dzial.PROPERTY_ID));
   
View Full Code Here

TOP

Related Classes of org.hibernate.criterion.ProjectionList

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.