Package org.hibernate

Examples of org.hibernate.Criteria.uniqueResult()


    String msg2 = Helper.getTranslation("prozesse");
    if (id != null) {
      String text = msg1 + " " + id + " (" + crit.uniqueResult() + " " + msg2 + ")";
      return new Batch(id, text);
    } else {
      String text = Helper.getTranslation("withoutBatch") + " (" + crit.uniqueResult() + " " + msg2 + ")";
      return new Batch(null, text);
    }
  }

  @SuppressWarnings("unchecked")
View Full Code Here


        applyAdditionalConstraints(criteria);

        criteria.setProjection(Projections.rowCount());

        Number result = (Number) criteria.uniqueResult();

        return result.intValue();
    }

    /**
 
View Full Code Here

        checkSession();

        Criteria query = verCfg.getRevisionInfoQueryCreator().getRevisionDateQuery(session, revision);

        try {
            Object timestampObject = query.uniqueResult();
            if (timestampObject == null) {
                throw new RevisionDoesNotExistException(revision);
            }

            // The timestamp object is either a date or a long
View Full Code Here

        checkSession();

        Criteria query = verCfg.getRevisionInfoQueryCreator().getRevisionNumberForDateQuery(session, date);

        try {
            Number res = (Number) query.uniqueResult();
            if (res == null) {
                throw new RevisionDoesNotExistException(date);
            }

            return res;
View Full Code Here

        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

    }
    else {
      Criteria criteria = session.createCriteria( entityInfo.getClazz() );
      criteria.add( Restrictions.eq( entityInfo.getIdName(), entityInfo.getId() ) );
      try {
        maybeProxy = criteria.uniqueResult();
      }
      catch ( HibernateException e ) {
        //FIXME should not raise an exception but return something like null
        //FIXME this happens when the index is out of sync with the db)
        throw new SearchException(
View Full Code Here

    }
    else {
      Criteria criteria = session.createCriteria( entityInfo.getClazz() );
      criteria.add( Restrictions.eq( entityInfo.getIdName(), entityInfo.getId() ) );
      try {
        maybeProxy = criteria.uniqueResult();
      }
      catch (HibernateException e) {
        //FIXME should not raise an exception but return something like null
        //FIXME this happens when the index is out of sync with the db)
        throw new SearchException(
View Full Code Here

    try {
      session = HibernateUtils.getCurrentSession();
      Criteria crit = session.createCriteria(Invoice.class);
      crit.add(Restrictions.eq("year", year));
      crit.setProjection(Projections.max("number"));
      Long maxNumberLong = (Long) crit.uniqueResult();
      if (maxNumberLong != null)
        maxNumber = maxNumberLong.intValue();
      crit.setProjection(null);
      crit.setResultTransformer(Criteria.ROOT_ENTITY);
    } catch (HibernateException ex) {
View Full Code Here

        checkSession();

        Criteria query = verCfg.getRevisionInfoQueryCreator().getRevisionDateQuery(session, revision);

        try {
            Object timestampObject = query.uniqueResult();
            if (timestampObject == null) {
                throw new RevisionDoesNotExistException(revision);
            }

            // The timestamp object is either a date or a long
View Full Code Here

        checkSession();

        Criteria query = verCfg.getRevisionInfoQueryCreator().getRevisionNumberForDateQuery(session, date);

        try {
            Number res = (Number) query.uniqueResult();
            if (res == null) {
                throw new RevisionDoesNotExistException(date);
            }

            return res;
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.