List of usage examples for org.springframework.orm ObjectRetrievalFailureException ObjectRetrievalFailureException
public ObjectRetrievalFailureException(String persistentClassName, Object identifier)
From source file:mx.edu.um.mateo.rh.dao.impl.EmpleadoDaoHibernate.java
/** * @see mx.edu.um.mateo.rh.dao.EmpleadoDao#getEmpleadoClave(mx.edu.um.mateo.rh.model.Empleado) *//*from ww w . j a v a 2 s . co m*/ @Override @Transactional(readOnly = true) public Empleado getEmpleadoClave(Empleado empleado) { Empleado emp = (Empleado) getSession().createCriteria(Empleado.class) .add(org.hibernate.criterion.Restrictions.eq("clave", empleado.getClave())).uniqueResult(); if (emp == null) { log.warn("uh oh, empleado with clave '" + empleado.getClave() + "' not found..."); throw new ObjectRetrievalFailureException(Empleado.class, empleado.getClave()); } return emp; }
From source file:mx.edu.um.mateo.rh.dao.impl.EmpleadoDaoHibernate.java
/** * @see mx.edu.um.mateo.rh.dao.EmpleadoDao#getEmpleado(java.lang.String) *//*from ww w . jav a 2s . c o m*/ @Override @Transactional(readOnly = true) public Empleado getEmpleado(final String clave) { Empleado emp = (Empleado) getSession().createCriteria(Empleado.class) .add(org.hibernate.criterion.Restrictions.eq("clave", clave)).uniqueResult(); if (emp == null) { log.warn("uh oh, empleado with clave '" + clave + "' not found..."); throw new ObjectRetrievalFailureException(Empleado.class, clave); } return emp; }
From source file:org.jdal.dao.hibernate.HibernateDao.java
/** * {@inheritDoc}// w w w.j av a 2 s . com */ public T get(PK id) { T entity = (T) getHibernateTemplate().get(this.entityClass, id); if (entity == null) { log.warn("'" + this.entityClass.getSimpleName() + "' object with id '" + id + "' not found..."); throw new ObjectRetrievalFailureException(this.entityClass, id); } return entity; }
From source file:org.opennms.ng.dao.support.DefaultResourceDao.java
/** * <p>getTopLevelResource</p> * * @param resourceType a {@link String} object. * @param resource a {@link String} object. * @return a {@link org.opennms.netmgt.model.OnmsResource} object. *//*ww w . ja v a 2 s. co m*/ protected OnmsResource getTopLevelResource(String resourceType, String resource) throws ObjectRetrievalFailureException { if ("node".equals(resourceType)) { return getNodeEntityResource(resource); } else if ("nodeSource".equals(resourceType)) { return getForeignSourceNodeEntityResource(resource); } else if ("domain".equals(resourceType)) { return getDomainEntityResource(resource); } else { throw new ObjectRetrievalFailureException( "Top-level resource type of '" + resourceType + "' is unknown", resourceType); } }
From source file:com.l2jfree.loginserver.dao.impl.GameserversDAOXml.java
/** * @see com.l2jfree.loginserver.dao.GameserversDAO#getAllGameservers() *///from ww w . j a va 2 s . co m @Override public List<Gameservers> getAllGameservers() { if (serverNames == null) throw new ObjectRetrievalFailureException("Could not load gameservers", new NullPointerException("serverNames")); return new ArrayList<Gameservers>(serverNames.values()); }
From source file:de.thorstenberger.examServer.dao.xml.UserDaoJAXB.java
public synchronized de.thorstenberger.examServer.model.User getUser(final Long userId) { final User u = getUserType(userId); if (u != null) return populateUser(u); log.warn("uh oh, user '" + userId + "' not found..."); throw new ObjectRetrievalFailureException(User.class, userId); }
From source file:org.esco.portlets.news.dao.iBatis.EntityDAOImpl.java
/** * Obtenir une entit partir de son id./*from w w w . j ava2 s. c o m*/ * @param entityId Id de l'entit recherche. * @return <code>Entity</code> Entit trouve. */ public Entity getEntityById(final Long entityId) { final Entity e = (Entity) getSqlMapClientTemplate().queryForObject("selectEntityById", entityId); if (e == null) { LOG.error("entity [" + entityId + "] not found"); throw new ObjectRetrievalFailureException(Entity.class, entityId); } return e; }
From source file:org.esco.portlets.news.dao.iBatis.FilterDAOImpl.java
/** * Obtain a filter from the id.//from w ww . java 2s . c om * @param filterId Id of the filter. * @return <code>Filter</code> */ public Filter getFilterById(final Long filterId) { final Filter f = (Filter) getSqlMapClientTemplate().queryForObject("selectFilterById", filterId); if (f == null) { LOG.error("filter [" + filterId + "] not found"); throw new ObjectRetrievalFailureException(Filter.class, filterId); } return f; }
From source file:org.esco.portlets.news.dao.iBatis.TypeDAOImpl.java
/** * Obtenir un Type partir de son id./* w ww .j a v a 2 s. c o m*/ * @param typeId Id du type recherch. * @return <code>Type</code> Type trouv. * @throws DataAccessException */ public Type getTypeById(final Long typeId) throws DataAccessException { final Type t = (Type) getSqlMapClientTemplate().queryForObject("selectTypeById", typeId); if (t == null) { LOG.error("type [" + typeId + "] not found"); throw new ObjectRetrievalFailureException(Type.class, typeId); } return t; }
From source file:org.esco.portlets.news.web.EntityEditController.java
/** * @param request/*from www .j av a 2s . c om*/ * @return Object * @throws Exception * @see org.springframework.web.portlet.mvc.AbstractFormController#formBackingObject(javax.portlet.PortletRequest) */ @Override protected Object formBackingObject(final PortletRequest request) throws Exception { if (LOG.isTraceEnabled()) { LOG.trace("Entering FormBackingObject of " + this.getClass().getName()); } Long eid = PortletRequestUtils.getLongParameter(request, Constants.ATT_ENTITY_ID); EntityForm entityF = new EntityForm(); if (eid != null) { entityF.setEntity(this.getEm().getEntityById(eid)); List<String> tIds = new ArrayList<String>(); for (Type t : this.getEm().getAutorizedTypesOfEntity(eid)) { tIds.add(String.valueOf(t.getTypeId())); } entityF.setTypesIds(tIds.toArray(new String[0])); return entityF; } throw new ObjectRetrievalFailureException(Entity.class, null); }