Package org.springframework.orm

Examples of org.springframework.orm.ObjectRetrievalFailureException


        dao.verify();
       
        // delete
        dao.reset();
        // expectations
        Exception ex = new ObjectRetrievalFailureException(User.class, "foo");
        dao.expects(once()).method("removeObject").isVoid();           
        dao.expects(once()).method("getObject").will(throwException(ex));
        manager.removeObject(User.class, "foo");
        try {
            manager.getObject(User.class, "foo");
View Full Code Here


     */
    public Object getObject(Class clazz, Serializable id) {
        Object o = getHibernateTemplate().get(clazz, id);

        if (o == null) {
            throw new ObjectRetrievalFailureException(clazz, id);
        }

        return o;
    }
View Full Code Here

     */
    public SystemValue getSystemValue(final String name) {
        SystemValue systemValue = (SystemValue) getHibernateTemplate().get(SystemValue.class, name);
        if (systemValue == null) {
            log.warn("uh oh, systemValue with name '" + name + "' not found...");
            throw new ObjectRetrievalFailureException(SystemValue.class, name);
        }

        return systemValue;
    }
View Full Code Here

    public User getUser(Long userId) {
        User user = (User) getHibernateTemplate().get(User.class, userId);

        if (user == null) {
            log.warn("uh oh, user '" + userId + "' not found...");
            throw new ObjectRetrievalFailureException(User.class, userId);
        }

        return user;
    }
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

  public Customer getCustomer(Integer id) {
    Customer customer = (Customer) getHibernateTemplate().get(
        Customer.class, id);
    if (customer == null) {
      throw new ObjectRetrievalFailureException(Customer.class, id);
    }
    return customer;
  }
View Full Code Here

  public Group getGroup(Integer id) {
    Group group = (Group) getHibernateTemplate().get(
        Group.class, id);
    if (group == null) {
      throw new ObjectRetrievalFailureException(Group.class, id);
    }
    return group;
  }
View Full Code Here

  public Invoice getInvoice(Integer id) {
    Invoice invoice = (Invoice) getHibernateTemplate().get(
        Invoice.class, id);
    if (invoice == null) {
      throw new ObjectRetrievalFailureException(Invoice.class, id);
    }
    return invoice;
  }
View Full Code Here

  public Vendor getVendor(Integer id) {
    Vendor vendor = (Vendor) getHibernateTemplate().get(
        Vendor.class, id);
    if (vendor == null) {
      throw new ObjectRetrievalFailureException(Vendor.class, id);
    }
    return vendor;
  }
View Full Code Here

  public Shape getShape(Integer id) {
    Shape shape = (Shape) getHibernateTemplate().get(
        Shape.class, id);
    if (shape == null) {
      throw new ObjectRetrievalFailureException(Shape.class, id);
    }
    return shape;
  }
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.