Package org.springframework.dao

Examples of org.springframework.dao.EmptyResultDataAccessException


   * @throws DataAccessException a corresponding exception,
   * by default an EmptyResultDataAccessException
   * @see org.springframework.dao.EmptyResultDataAccessException
   */
  protected void handleNoRowFound() throws DataAccessException {
    throw new EmptyResultDataAccessException(
        "LobStreamingResultSetExtractor did not find row in database", 1);
  }
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

  public void streamImage(final String name, final OutputStream contentStream) throws DataAccessException {
    getJdbcTemplate().query(
        "SELECT content FROM imagedb WHERE image_name=?", new Object[] {name},
        new AbstractLobStreamingResultSetExtractor() {
          protected void handleNoRowFound() throws LobRetrievalFailureException {
            throw new EmptyResultDataAccessException(
                "Image with name '" + name + "' not found in database", 1);
          }
          public void streamData(ResultSet rs) throws SQLException, IOException {
            InputStream is = lobHandler.getBlobAsBinaryStream(rs, 1);
            if (is != null) {
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

  public final R find( @NotNull Session session ) throws DataAccessException {
    Criteria criteria = createCriteria( session );
    addRestrictions( criteria );
    R found = execute( criteria );
    if ( found == null ) {
      throw new EmptyResultDataAccessException( 1 );
    }
    return found;
  }
View Full Code Here

  @Override
  @NotNull
  public T findById( @NotNull Long id ) throws DataAccessException {
    T found = type.cast( getHibernateTemplate().get( type, id ) );
    if ( found == null ) {
      throw new EmptyResultDataAccessException( 1 );
    }
    return found;
  }
View Full Code Here

  public UserDetails loadUserByUsername(String username)
      throws UsernameNotFoundException {
   
    try{
      User user = userService.getSystemUserByUsername(username);
      if(user==null) throw new EmptyResultDataAccessException(1);
     
      CartUserDetails userDetails = new CartUserDetails();
      userDetails.userId = user.getId();
      userDetails.salt = user.getSalt();
      userDetails.password = user.getPassword();
View Full Code Here

  @Override
  public UserDetails loadUserByUsername(String email)
      throws UsernameNotFoundException {
    try{
      Affiliate affiliate = userService.getAffiliateByEmail(email);
      if(affiliate==null) throw new EmptyResultDataAccessException(1);
     
      CartUserDetails userDetails = new CartUserDetails();
      userDetails.userId = affiliate.getId();
      userDetails.salt = affiliate.getSalt();
      userDetails.password = affiliate.getPassword();
View Full Code Here

  @Override
  public UserDetails loadUserByUsername(String email)
      throws UsernameNotFoundException {
    try{
      Customer customer = userService.getCustomerByEmail(email);
      if(customer==null) throw new EmptyResultDataAccessException(1);
     
      CartUserDetails userDetails = new CartUserDetails();
      userDetails.userId = customer.getId();
      userDetails.salt = customer.getSalt();
      userDetails.password = customer.getPassword();
View Full Code Here

    Assert.notNull(id, "The given id must not be null!");

    T entity = findOne(id);

    if (entity == null) {
      throw new EmptyResultDataAccessException(String.format("No %s entity with id %s exists!",
          entityInformation.getJavaType(), id), 1);
    }

    delete(entity);
  }
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.