Code example for ObjectRetrievalFailureException

0
        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; 
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
    @SuppressWarnings("unchecked") 
    public boolean exists(PK id) { 
        Session sess = getSession(); 
        IdentifierLoadAccess byId = sess.byId(persistentClass); 
        T entity = (T) byId.load(id); 
        return entity != null;