Package org.springframework.orm

Examples of org.springframework.orm.ObjectRetrievalFailureException


    query.setSelectionKey(new Vector(Arrays.asList(keys)));
    Object result = executeQuery(query, enforceReadOnly);

    if (result == null) {
      Object identifier = (keys.length == 1 ? keys[0] : StringUtils.arrayToCommaDelimitedString(keys));
      throw new ObjectRetrievalFailureException(entityClass, identifier);
    }
    return result;
  }
View Full Code Here


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

          "SELECT id, name, birth_date, type_id, owner_id FROM pets WHERE id=?",
          new JdbcPetRowMapper(),
          id);
    }
    catch (EmptyResultDataAccessException ex) {
      throw new ObjectRetrievalFailureException(Pet.class, new Integer(id));
    }
    Owner owner = loadOwner(pet.getOwnerId());
    owner.addPet(pet);
    pet.setType(EntityUtils.getById(getPetTypes(), PetType.class, pet.getTypeId()));
    loadVisits(pet);
View Full Code Here

  public Object getObject(Class clazz, Serializable id) {
    Object o = getHibernateTemplate().get(clazz, id);
 
      if (o == null) {
        log.warn(clazz.getName() + " '" + id + "' not found!");
          throw new ObjectRetrievalFailureException(clazz, id);
      }
 
      return o;
  }
View Full Code Here

        try {
            if (entity == null) {
                this.log.warn("Uh oh, '" + this.persistentClass
                        + "' object with id '" + id + "' not found...");
                throw ExceptionUtil.crearCrudException("ERROR_SELECT_BD",
                        new ObjectRetrievalFailureException(
                                this.persistentClass, id));
            }
        } catch (final DataAccessException e) {
            this.log.error("ERROR al obtener en BD:\n " + e);
            throw ExceptionUtil.crearCrudException("ERROR_SELECT_BD", e);
View Full Code Here

        // reset expectations
        daoMock.reset();

        // remove

        Exception ex = new ObjectRetrievalFailureException(Pista.class,
            bean.getId());

        daoMock.expects(once()).method("remove").isVoid();

        daoMock.expects(once()).method("get").will(throwException(ex));
View Full Code Here

        // reset expectations
        daoMock.reset();

        // remove

        Exception ex = new ObjectRetrievalFailureException(Contacto.class,
            bean.getId());

        daoMock.expects(once()).method("remove").isVoid();

        daoMock.expects(once()).method("get").will(throwException(ex));
View Full Code Here

        // reset expectations
        daoMock.reset();

        // remove

        Exception ex = new ObjectRetrievalFailureException(Llamada.class,
            bean.getId());

        daoMock.expects(once()).method("remove").isVoid();

        daoMock.expects(once()).method("get").will(throwException(ex));
View Full Code Here

        // reset expectations
        daoMock.reset();

        // remove

        Exception ex = new ObjectRetrievalFailureException(Socio.class,
            bean.getId());

        daoMock.expects(once()).method("remove").isVoid();

        daoMock.expects(once()).method("get").will(throwException(ex));
View Full Code Here

        for (T entity : entities) {
            if (entity.getId().intValue() == entityId && entityClass.isInstance(entity)) {
                return entity;
            }
        }
        throw new ObjectRetrievalFailureException(entityClass, entityId);
    }
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.