Package org.springframework.orm

Examples of org.springframework.orm.ObjectRetrievalFailureException


                    "SELECT id, first_name, last_name, address, city, telephone FROM owners WHERE id= :id",
                    params,
                    ParameterizedBeanPropertyRowMapper.newInstance(Owner.class)
            );
        } catch (EmptyResultDataAccessException ex) {
            throw new ObjectRetrievalFailureException(Owner.class, id);
        }
        loadPetsAndVisits(owner);
        return owner;
    }
View Full Code Here


            pet = this.namedParameterJdbcTemplate.queryForObject(
                    "SELECT id, name, birth_date, type_id, owner_id FROM pets WHERE id=:id",
                    params,
                    new JdbcPetRowMapper());
        } catch (EmptyResultDataAccessException ex) {
            throw new ObjectRetrievalFailureException(Pet.class, new Integer(id));
        }
        Owner owner = this.ownerRepository.findById(pet.getOwnerId());
        owner.addPet(pet);
        pet.setType(EntityUtils.getById(findPetTypes(), PetType.class, pet.getTypeId()));
View Full Code Here

    public Ticket get(final long id) {
        Ticket ticket = ticketDao.findOne(id);
        if (ticket != null) {
            return ticket;
        }
        throw new ObjectRetrievalFailureException(Ticket.class, id);
    }
View Full Code Here

    }

    public Location addLocationScan(Ticket ticket, Long locationId) {
        Location location = locationDao.findOne(locationId);
        if (location == null) {
            throw new ObjectRetrievalFailureException(Ticket.class, locationId);
        }

        LocationScan locationScan = new LocationScan();
        locationScan.setLocation(location);
        locationScan.setTimestamp(new Date());
View Full Code Here

                locationIterator.remove();
                return;
            }
        }

        throw new ObjectRetrievalFailureException(Location.class, locationId);
    }
View Full Code Here

  }
 
  public void deleteById(PK id) {
    Object entity = getById(id);
    if(entity == null) {
      throw new ObjectRetrievalFailureException(getEntityClass(),id);
    }
    getHibernateTemplate().delete(entity);
  }
View Full Code Here

    if (ex instanceof ObjectDeletedException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof UnresolvableObjectException) {
      UnresolvableObjectException hibEx = (UnresolvableObjectException) ex;
      return new ObjectRetrievalFailureException(hibEx.getEntityName(), hibEx.getIdentifier(), ex.getMessage(), ex);
    }
    if (ex instanceof WrongClassException) {
      WrongClassException hibEx = (WrongClassException) ex;
      return new ObjectRetrievalFailureException(hibEx.getEntityName(), hibEx.getIdentifier(), ex.getMessage(), ex);
    }
    if (ex instanceof StaleObjectStateException) {
      StaleObjectStateException hibEx = (StaleObjectStateException) ex;
      return new ObjectOptimisticLockingFailureException(hibEx.getEntityName(), hibEx.getIdentifier(), ex);
    }
View Full Code Here

          SQL_SELECT + "WHERE id=?",
          BeanPropertyRowMapper.newInstance(Contact.class),
          id);
    }
    catch (EmptyResultDataAccessException ex) {
      throw new ObjectRetrievalFailureException(Contact.class, id);
    }

        return contact;
    }
View Full Code Here

    public T get(PK id) {
        T entity = (T) hibernateTemplate.get(this.persistentClass, id);

        if (entity == null) {
            log.warn("Uh oh, '" + this.persistentClass + "' object with id '" + id + "' not found...");
            throw new ObjectRetrievalFailureException(this.persistentClass, id);
        }

        return entity;
    }
View Full Code Here

    T entity = (T) em.find(this.persistentClass, id);

    if (entity == null) {
      log.warn("Uh oh, '" + this.persistentClass + "' object with id '" + id
          + "' not found...");
      throw new ObjectRetrievalFailureException(this.persistentClass, id);
    }

    return entity;
  }
View Full Code Here

TOP

Related Classes of org.springframework.orm.ObjectRetrievalFailureException

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.