Package org.hibernate

Examples of org.hibernate.Criteria.createCriteria()


                    String key = param[0];
                    if (!key.equals(".ignore")) {
                        if (key.contains(".")) {
                            String[] parts = key.split("\\.");
                            for (int j = 0; j < parts.length - 1; j++) {
                                current = current.createCriteria(parts[j], parts[j]);
                            }
                        }
                        current.add(Restrictions.eq(key, convertType(param[1], OptionFilterParamType.valueOf(param[2]))));
                    }
                }
View Full Code Here


    s.close();

    s = openSession();
    tx = s.beginTransaction();
    Criteria crit = s.createCriteria( Life.class );
    crit.createCriteria( "owner" ).add( Expression.eq( "name", "kitty" ) );
    life = (Life) crit.uniqueResult();
    assertEquals( "Long long description", life.fullDescription );
    s.delete( life.owner );
    s.delete( life );
    tx.commit();
View Full Code Here

                    Restrictions.eq("opcional", ( !base ))).setResultTransformer(
                    Criteria.DISTINCT_ROOT_ENTITY);

            if (!base) {
                if (historico != null) {
                    criteria = criteria.createCriteria("capasInformacion");
                    if (!historico) {
                        criteria.add(Restrictions.eq("visibleGPS", true));
                    } else {
                        criteria.add(Restrictions.eq("visibleHistorico", true));
                    }
View Full Code Here

          .getGenericString(u.getNombre())));
    if (u.getApellidos() != null)
      criteria = criteria.add(Restrictions.ilike("apellidos",
          LogicConstants.getGenericString(u.getApellidos())));
    if (u.getRoles() != null)
      criteria = criteria.createCriteria("roles").add(
          Restrictions.ilike("nombre", LogicConstants
              .getGenericString(u.getRoles().getNombre())));

    res = criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
        .list();
View Full Code Here

    @Override
    @Transactional(readOnly = true)
    public User getByUsername(String username) {
        Criteria criteria = getSession().createCriteria(User.class);
        criteria.add(Restrictions.eq("username", username));
        criteria.createCriteria("roles");
        criteria.setMaxResults(1);
        User user = null;
        if (!criteria.list().isEmpty()) {
            user = (User) criteria.list().get(0);
        } else {
View Full Code Here

      Scanner scanner = new Scanner(atributo);
      scanner.useDelimiter("\\.");
      String associationPath = scanner.next();
      Criteria joinCriteria = criteria;
      while (scanner.hasNext()) {
        joinCriteria = joinCriteria.createCriteria(associationPath);
        associationPath = scanner.next();
      }
      joinCriteria.add(Restrictions.eq(associationPath, valor));
    }
    return this;
View Full Code Here

    s.close();

    s = openSession();
    tx = s.beginTransaction();
    Criteria crit = s.createCriteria( Life.class );
    crit.createCriteria( "owner" ).add( Expression.eq( "name", "kitty" ) );
    life = (Life) crit.uniqueResult();
    assertEquals( "Long long description", life.fullDescription );
    s.delete( life.owner );
    s.delete( life );
    tx.commit();
View Full Code Here

    if (completed != null) {
      cr.add(Restrictions.eq("completed", completed));
    }

    cr.createCriteria("payer").add(Restrictions.eq("id", payer.getId()));

    if (amount != null) {
      cr.setMaxResults(amount);
    }
View Full Code Here

    if (completed != null) {
      cr.add(Restrictions.eq("completed", completed));
    }

    cr.createCriteria("recipient").add(
        Restrictions.eq("id", recipient.getId()));

    if (amount != null) {
      cr.setMaxResults(amount);
    }
View Full Code Here

   */
  public Collection<MatrixRow> findByLabel(String pTaxonLabel) {
    Criteria c;

    c = getSession().createCriteria(MatrixRow.class);
    c.createCriteria("taxonLabel").add(Restrictions.eq("taxonLabel", pTaxonLabel));
    return c.list();
  }

  /* (non-Javadoc)
   * @see org.cipres.treebase.domain.matrix.MatrixRowHome#findByTaxonLabel(org.cipres.treebase.domain.taxon.TaxonLabel)
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.