Package org.hibernate

Examples of org.hibernate.Criteria.createAlias()


      for (int i = 0; i < props.length - 1; i++) {
        String alias = props[i] + "_alias";
        if (!aliases.contains(alias)) {
          Criteria criteria = (Criteria) userData;
          if (i == 0) {
            criteria.createAlias(props[0], alias);
          } else {
            criteria.createAlias(prevAlias + "." + props[i], alias);
          }
          aliases.add(alias);
        }
View Full Code Here


        if (!aliases.contains(alias)) {
          Criteria criteria = (Criteria) userData;
          if (i == 0) {
            criteria.createAlias(props[0], alias);
          } else {
            criteria.createAlias(prevAlias + "." + props[i], alias);
          }
          aliases.add(alias);
        }
        prevAlias = alias;
      }
View Full Code Here

            if (orderBy != null) {
              crit.addOrder(Order.asc(orderBy));
            }
           
            crit.createAlias("supplierType", "supplierType");
            crit.add(Restrictions.ilike("supplierType.supplierTypeName", typeString));

            if (productAreaGroup != null&&!productAreaGroup.getProductAreaGroupName().equalsIgnoreCase("Alle")) {

              crit = crit
View Full Code Here

    }

    if (conjTemplates != null) {
      if (flagSteps) {
        critProcess.createCriteria("vorlagen", "vorl");
        critProcess.createAlias("vorl.eigenschaften", "vorleig");
        critProcess.add(conjTemplates);
      } else {
        crit.createCriteria("vorlagen", "vorl");
        crit.createAlias("vorl.eigenschaften", "vorleig");
        inCrit.add(conjTemplates);
View Full Code Here

      }
    }

    if (conjProcessProperties != null) {
      if (flagSteps) {
        critProcess.createAlias("proc.eigenschaften", "prozesseig");
        critProcess.add(conjProcessProperties);
      } else {

        inCrit.createAlias("eigenschaften", "prozesseig");
        inCrit.add(conjProcessProperties);
View Full Code Here

    if (conjStepProperties != null) {
      if (!flagSteps) {
        Criteria stepCrit = session.createCriteria(Prozess.class);
        stepCrit.createCriteria("schritte", "steps");
        stepCrit.createAlias("steps.eigenschaften", "schritteig");
        stepCrit.add(conjStepProperties);
        stepCrit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
        List<Integer> myIds = new ArrayList<Integer>();

        for (@SuppressWarnings("unchecked")
View Full Code Here

        final int ndx = sortProperty.lastIndexOf('.');
        if (ndx != -1)
        {
            final String associationPath = sortProperty.substring(0, ndx);
            final String propertyName = sortProperty.substring(ndx + 1);
            c = c.createAlias(associationPath, ASSOCIATION_ALIAS)
                    .addOrder(ascending ? Order.asc(ASSOCIATION_ALIAS + "." + propertyName) : Order.desc(ASSOCIATION_ALIAS + "." + propertyName));
        }
        else
        {
            c = c.addOrder(ascending ? Order.asc(sortProperty) : Order.desc(sortProperty));
View Full Code Here

    Session s = openSession();
    s.getTransaction().begin();

    Criteria rootCriteria = s.createCriteria( Order.class );
    // create alias, ensuring we stay on the root criteria
    assertSame( rootCriteria, rootCriteria.createAlias( "orderLines", "ol", JoinFragment.LEFT_OUTER_JOIN ) );

    // add restrictions to rootCriteria
    assertSame( rootCriteria, rootCriteria.add( Restrictions.eq( "ol.articleId", "3000" ) ) );

    List orders = rootCriteria.list();
View Full Code Here

    Session s = openSession();
    s.getTransaction().begin();

    Criteria rootCriteria = s.createCriteria( Order.class );
    // create alias, ensuring we stay on the root criteria
    assertSame( rootCriteria, rootCriteria.createAlias( "orderLines", "ol", JoinFragment.LEFT_OUTER_JOIN ) );

    // add restrictions to rootCriteria
    assertSame(
        rootCriteria,
        rootCriteria.add(
View Full Code Here

  public List<IWorkItem> findWorkItemsForTaskInstance(final String taskInstanceId){
        List<IWorkItem> result = (List<IWorkItem>) this.getHibernateTemplate().execute(new HibernateCallback() {

      public Object doInHibernate(Session arg0) throws HibernateException, SQLException {
              Criteria criteria = arg0.createCriteria(WorkItem.class);
              criteria.createAlias("taskInstance", "taskInstance");
              criteria.add(Expression.eq("taskInstance.id", taskInstanceId));
               
              return (List<IWorkItem>) criteria.list();
            }
        });
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.