Package org.springframework.orm

Examples of org.springframework.orm.ObjectRetrievalFailureException


    return execute(new PersistenceBrokerCallback() {
      public Object doInPersistenceBroker(PersistenceBroker pb) throws PersistenceBrokerException {
        Identity id = pb.serviceIdentity().buildIdentity(entityClass, idValue);
        Object result = pb.getObjectByIdentity(id);
        if (result == null) {
          throw new ObjectRetrievalFailureException(entityClass, idValue);
        }
        return result;
      }
    });
  }
View Full Code Here


      BaseEntity entity = (BaseEntity) it.next();
      if (entity.getId().intValue() == entityId && entityClass.isInstance(entity)) {
        return entity;
      }
    }
    throw new ObjectRetrievalFailureException(entityClass, new Integer(entityId));
  }
View Full Code Here

  }

  public Owner loadOwner(int id) throws DataAccessException {
    Owner owner = (Owner) getBrokerTemplate().selectOne("loadOwnerById", "id", new Integer(id));
    if (owner == null) {
      throw new ObjectRetrievalFailureException(Owner.class, new Integer(id));
    }
    // load pets and visits
    loadPetsAndVisits(owner);
    return owner;
  }
View Full Code Here

  }

  public Pet loadPet(int id) throws DataAccessException {
    Pet pet = (Pet) getBrokerTemplate().selectOne("loadPetById", "id", new Integer(id));
    if (pet == null) {
      throw new ObjectRetrievalFailureException(Pet.class, new Integer(id));
    }
    //load owner
    Owner owner = (Owner) getBrokerTemplate().selectOne("loadOwnerByPet", "id", pet.getId());
    owner.addPet(pet);
    // load visits
View Full Code Here

      Entity entity = (Entity) it.next();
      if (entity.getId().intValue() == entityId && entityClass.isInstance(entity)) {
        return entity;
      }
    }
    throw new ObjectRetrievalFailureException(entityClass, new Integer(entityId));
  }
View Full Code Here

    public User get(Long userId) {
        User user = (User) getSqlMapClientTemplate().queryForObject("getUser", userId);

        if (user == null) {
            log.warn("uh oh, user not found...");
            throw new ObjectRetrievalFailureException(User.class, userId);
        } else {
            List roles = getSqlMapClientTemplate().queryForList("getUserRoles", user);
            user.setRoles(new HashSet<Role>(roles));
        }
View Full Code Here

        IdentifierLoadAccess byId = sess.byId(persistentClass);
        T entity = (T) byId.load(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

    public T get(PK id) {
        T object = (T) getSqlMapClientTemplate().queryForObject(
                iBatisDaoUtils.getFindQuery(ClassUtils.getShortName(this.persistentClass)), id);
        if (object == null) {
            log.warn("Uh oh, '" + this.persistentClass + "' object with id '" + id + "' not found...");
            throw new ObjectRetrievalFailureException(ClassUtils.getShortName(this.persistentClass), id);
        }
        return object;
    }
View Full Code Here

            getSqlMapClientTemplate().update(iBatisDaoUtils.getUpdateQuery(className), object);
        }

        // check for null id
        if (iBatisDaoUtils.getPrimaryKeyValue(object) == null) {
            throw new ObjectRetrievalFailureException(className, object);
        } else {
            return object;
        }
    }
View Full Code Here

    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

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.