Package org.hibernate

Examples of org.hibernate.Criteria.uniqueResult()


        Set<Number> revisions = new HashSet<Number>(1);
        revisions.add(revision);
        Criteria query = verCfg.getRevisionInfoQueryCreator().getRevisionsQuery(session, revisions);

        try {
            T revisionData = (T) query.uniqueResult();

            if (revisionData == null) {
                throw new RevisionDoesNotExistException(revision);
            }
View Full Code Here


      session = hibernateProvider.openSession();
     
      Criteria criteria = session.createCriteria(ReportParameter.class);
      criteria.add(Restrictions.eq("name", name));
     
      return (ReportParameter) criteria.uniqueResult();
    }
    catch (HibernateException he)
    {
      throw new ProviderException(he);
    }
View Full Code Here

      session = hibernateProvider.openSession();
     
      Criteria criteria = session.createCriteria(ReportDataSource.class);
      criteria.add(Restrictions.eq("name", name));
     
      return (ReportDataSource) criteria.uniqueResult();
    }
    catch (HibernateException he)
    {
      throw new ProviderException(he);
    }
View Full Code Here

      session = hibernateProvider.openSession();
     
      Criteria criteria = session.createCriteria(Report.class);
      criteria.add(Restrictions.eq("name", name));
     
      return (Report) criteria.uniqueResult();
    }
    catch (HibernateException he)
    {
      throw new ProviderException(he);
    }
View Full Code Here

      session = hibernateProvider.openSession();
     
      Criteria criteria = session.createCriteria(ReportChart.class);
      criteria.add(Restrictions.eq("name", name));
     
      return (ReportChart) criteria.uniqueResult();
    }
    catch (HibernateException he)
    {
      throw new ProviderException(he);
    }
View Full Code Here

    c.add(Restrictions.eq("instance",_instance));
    c.setProjection(Projections.projectionList().add(Projections.min("tstamp"))
                                                .add(Projections.max("tstamp"))
                                                .add(Projections.count("tstamp")));
   
    Object[] ret = (Object[]) c.uniqueResult();
    EventsFirstLastCountTuple flc = new EventsFirstLastCountTuple();
    flc.first = (Date) ret[0];
    flc.last = (Date) ret[1];
    flc.count = (Integer)ret[2];
    return flc;
View Full Code Here

        try {
            Criteria criteria = _session.createCriteria(HProcess.class);
            criteria.add(Expression.eq("processId", processId.toString()));
            // For the moment we are expecting only one result.
            HProcess hprocess = (HProcess) criteria.uniqueResult();
            return hprocess == null ? null : new ProcessDaoImpl(_sm, hprocess);
        } catch (HibernateException e) {
            __log.error("DbError", e);
            throw e;
        }
View Full Code Here

    c.add(Restrictions.eq("instance",_instance));
    c.setProjection(Projections.projectionList().add(Projections.min("tstamp"))
                                                .add(Projections.max("tstamp"))
                                                .add(Projections.count("tstamp")));
   
    Object[] ret = (Object[]) c.uniqueResult();
    EventsFirstLastCountTuple flc = new EventsFirstLastCountTuple();
    flc.first = (Date) ret[0];
    flc.last = (Date) ret[1];
    flc.count = (Integer)ret[2];
    return flc;
View Full Code Here

                            criteria.add(Restrictions.eq("uuid", nodeIdentifier));
                            criteria.add(Restrictions.eq("date", date != null ? Long.valueOf(date.getTime()) : null));
                            criteria.add(Restrictions.eq("propertyName", propertyName));
                            criteria.add(Restrictions.eq("action", action));

                            HistoryEntry historyEntry = (HistoryEntry) criteria.uniqueResult();
                            // Found update object
                            if (historyEntry != null) {
                                // history entry already exists, we will not update it.
                                if (logger.isDebugEnabled()) {
                                    logger.debug("Content history entry " + historyEntry + " already exists, ignoring...");
View Full Code Here

    public ProcessDAO getProcess(QName processId) {
        try {
            Criteria criteria = getSession().createCriteria(HProcess.class);
            criteria.add(Expression.eq("processId", processId.toString()));
            // For the moment we are expecting only one result.
            HProcess hprocess = (HProcess) criteria.uniqueResult();
            return hprocess == null ? null : new ProcessDaoImpl(_sm, hprocess);
        } catch (HibernateException e) {
            __log.error("DbError", e);
            throw e;
        }
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.