Package org.springframework.dao

Examples of org.springframework.dao.EmptyResultDataAccessException


        int[] updateCounts = results.get(0).getUpdateCounts();

        for (int i = 0; i < updateCounts.length; i++) {
          int value = updateCounts[i];
          if (value == 0) {
            throw new EmptyResultDataAccessException("Item " + i + " of " + updateCounts.length
                + " did not update any rows: [" + items.get(i) + "]", 1);
          }
        }
      }
    }
View Full Code Here


    }

    public EventStream<E> getStream(UUID streamId) {
        EventStream<E> stream = eventStreams.get(streamId);
        if (stream == null) {
            throw new EmptyResultDataAccessException("unknown event stream " + streamId, 1);
        }
        return stream;
    }
View Full Code Here

            sendEventsToSink(result, lastEvent, sink);
        }

        private void sendEventsToSink(List<E> events, VersionedEvent<E> lastEvent, EventSink<E> sink) {
            if (lastEvent == null) {
                throw new EmptyResultDataAccessException("no event found for specified version or timestamp", 1);
            }
            sink.setVersion(lastEvent.getVersion());
            sink.setTimestamp(lastEvent.getTimestamp());
            sink.setEvents(events);
        }
View Full Code Here

        List<StoredEvent<E>> storedEvents = jdbcTemplate.query(
                "select version, timestamp, data from event where event_stream_id = ? and version <= ? order by sequence_number",
                new StoredEventRowMapper(),
                stream.getId().toString(), version);
        if (storedEvents.isEmpty()) {
            throw new EmptyResultDataAccessException("no events found for stream " + stream.getId() + " for version " + version, 1);
        }
        return storedEvents;
    }
View Full Code Here

        List<StoredEvent<E>> storedEvents = jdbcTemplate.query(
                "select version, timestamp, data from event where event_stream_id = ? and timestamp <= ? order by sequence_number",
                new StoredEventRowMapper(),
                stream.getId().toString(), new Date(timestamp));
        if (storedEvents.isEmpty()) {
            throw new EmptyResultDataAccessException("no events found for stream " + stream.getId() + " for timestamp " + timestamp, 1);
        }
        return storedEvents;
    }
View Full Code Here

            throw new DataRetrievalFailureException("Failed to retrieve ChannelDefinition for fName='" + fName + "'", e);
        }
       
        //The channel definition for the fName MUST exist for this class to function
        if (channelDefinition == null) {
            throw new EmptyResultDataAccessException("No ChannelDefinition exists for fName='" + fName + "'", 1);
        }
       
        //get/create the portlet definition
        final int channelDefinitionId = channelDefinition.getId();
        final IPortletDefinition portletDefinition = this.portletDefinitionRegistry.getOrCreatePortletDefinition(channelDefinitionId);
View Full Code Here

    // Check for well-known PersistenceException subclasses.
    if (ex instanceof EntityNotFoundException) {
      return new JpaObjectRetrievalFailureException((EntityNotFoundException) ex);
    }
    if (ex instanceof NoResultException) {
      return new EmptyResultDataAccessException(ex.getMessage(), 1);
    }
    if (ex instanceof NonUniqueResultException) {
      return new IncorrectResultSizeDataAccessException(ex.getMessage(), 1, ex);
    }
    if (ex instanceof OptimisticLockException) {
View Full Code Here

    // Check for well-known PersistenceException subclasses.
    if (ex instanceof EntityNotFoundException) {
      return new JpaObjectRetrievalFailureException((EntityNotFoundException) ex);
    }
    if (ex instanceof NoResultException) {
      return new EmptyResultDataAccessException(ex.getMessage(), 1);
    }
    if (ex instanceof NonUniqueResultException) {
      return new IncorrectResultSizeDataAccessException(ex.getMessage(), 1);
    }
    if (ex instanceof OptimisticLockException) {
View Full Code Here

   * has been found in the given Collection
   */
  public static Object requiredSingleResult(Collection results) throws IncorrectResultSizeDataAccessException {
    int size = (results != null ? results.size() : 0);
    if (size == 0) {
      throw new EmptyResultDataAccessException(1);
    }
    if (results.size() > 1) {
      throw new IncorrectResultSizeDataAccessException(1, size);
    }
    return results.iterator().next();
View Full Code Here

   * @see org.springframework.util.CollectionUtils#hasUniqueObject
   */
  public static Object requiredUniqueResult(Collection results) throws IncorrectResultSizeDataAccessException {
    int size = (results != null ? results.size() : 0);
    if (size == 0) {
      throw new EmptyResultDataAccessException(1);
    }
    if (!CollectionUtils.hasUniqueObject(results)) {
      throw new IncorrectResultSizeDataAccessException(1, size);
    }
    return results.iterator().next();
View Full Code Here

TOP

Related Classes of org.springframework.dao.EmptyResultDataAccessException

Copyright © 2018 www.massapicom. 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.