Package org.hibernate

Examples of org.hibernate.Criteria.list()


        // Add startDateMax criteria
        if (criteria.getStartDateMax() != null) {
            timecardCriteria.add(Restrictions.le("startDate", criteria.getStartDateMax()));
        }

        java.util.List timecards = timecardCriteria.list();
        if (logger.isDebugEnabled()) {
            logger.debug(timecards.size() + " timecards found");
        }
        return timecards;
    }
View Full Code Here


      criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

      if (isScrollableResultSet()) {
        return (Iterator<?>) new ScrollIterator(criteria.scroll());
      } else {
        List<?> list = criteria.list();
        return list.iterator();
      }
    } catch (HibernateException he) {
      throw new HibernateLayerException(he, ExceptionCode.HIBERNATE_LOAD_FILTER_FAIL, getFeatureInfo()
          .getDataSourceName(), filter.toString());
View Full Code Here

      if (c != null) {
        criteria.add(c);
      }
    }
    List<Attribute<?>> attributes = new ArrayList<Attribute<?>>();
    for (Object object : criteria.list()) {
      try {
        attributes.add(converterService.toDto(object, attributeInfo));
      } catch (GeomajasException e) {
        throw new HibernateLayerException(e, ExceptionCode.HIBERNATE_ATTRIBUTE_TYPE_PROBLEM, attributeName);
      }
View Full Code Here

      Criterion c = (Criterion) filter.accept(visitor, criteria);
      if (c != null) {
        criteria.add(c);
      }
      criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
      List<?> features = criteria.list();
      Envelope bounds = new Envelope();
      for (Object f : features) {
        Envelope geomBounds = getFeatureModel().getGeometry(f).getEnvelopeInternal();
        if (!geomBounds.isNull()) {
          bounds.expandToInclude(geomBounds);
View Full Code Here

    public List<User> findByExample(User exampleUser, String orderByProperty, boolean orderDescending,
                                    int firstResult, int maxResults, String... ignoreProperty) {
        Criteria crit = prepareExampleCriteria(exampleUser, orderByProperty, orderDescending, ignoreProperty);
        crit.setFirstResult(firstResult).setMaxResults(maxResults);
        return (List<User>)crit.list();
    }

    public int getRowCountByExample(User exampleUser, String... ignoreProperty) {

        Criteria crit = prepareExampleCriteria(exampleUser, null, false, ignoreProperty);
View Full Code Here

   */
  protected void _deleteById(Class<?> type, Serializable... ids) {
    type = metadataUtil.getUnproxiedClass(type); //Get the real entity class
    Criteria c = getSession().createCriteria(type);
    c.add(Restrictions.in("id", ids));
    for (Object entity : c.list()) {
      getSession().delete(entity);
    }
  }

  /**
 
View Full Code Here

    type = metadataUtil.getUnproxiedClass(type); //Get the real entity class
    Criteria c = getSession().createCriteria(type);
    c.add(Restrictions.in("id", ids));
    Object[] retVal = (Object[]) Array.newInstance(type, ids.length);

    for (Object entity : c.list()) {
      Serializable id = getMetadataUtil().getId(entity);
      for (int i = 0; i < ids.length; i++) {
        if (id.equals(ids[i])) {
          retVal[i] = entity;
          break;
View Full Code Here

        // using Hibernate Session and Criteria Query via Hibernate Native API
        Session session = (Session) em.getDelegate();
        Criteria cb = session.createCriteria(Member.class);
        cb.addOrder(Order.asc("name"));
        members = (List<Member>) cb.list();

    }
}
View Full Code Here

    public List<Member> findAllOrderedByName() {
        // using Hibernate Session and Criteria Query via Hibernate Native API
        Session session = (Session) em.getDelegate();
        Criteria cb = session.createCriteria(Member.class);
        cb.addOrder(Order.asc("name"));
        return (List<Member>) cb.list();
        // return members;
    }
}
View Full Code Here

    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      Criteria c = session.createCriteria(RightsGroup.class);
      c.add(Restrictions.eq("groupName", groupName));
      List<RightsGroup> lstRights = c.list();
      if(lstRights != null && lstRights.size() > 0) {
        group = lstRights.get(0);
      }
    } catch (Exception a_th) {
      throw new RuntimeException(a_th);
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.