Examples of EntityNotFoundException


Examples of javax.persistence.EntityNotFoundException

        try {
            configurationDefinition = (ConfigurationDefinition) query.getSingleResult();
        } catch (NoResultException e) {
            PackageType packageType = entityManager.find(PackageType.class, packageTypeId);
            if (packageType == null) {
                throw new EntityNotFoundException("A package type with id " + packageTypeId + " does not exist.");
            }
        }

        return configurationDefinition;
    }
View Full Code Here

Examples of javax.persistence.EntityNotFoundException

        try {
            configurationDefinition = (ConfigurationDefinition) query.getSingleResult();
        } catch (NoResultException e) {
            ResourceType resourceType = entityManager.find(ResourceType.class, resourceTypeId);
            if (resourceType == null) {
                throw new EntityNotFoundException("A resource type with id " + resourceTypeId + " does not exist.");
            }
        }

        return configurationDefinition;
    }
View Full Code Here

Examples of javax.persistence.EntityNotFoundException

        try {
            configurationDefinition = (ConfigurationDefinition) query.getSingleResult();
        } catch (NoResultException e) {
            ResourceType resourceType = entityManager.find(ResourceType.class, resourceTypeId);
            if (resourceType == null) {
                throw new EntityNotFoundException("A resource type with id " + resourceTypeId + " does not exist.");
            }
        }

        // Eager Load the templates
        if ((configurationDefinition != null) && (configurationDefinition.getTemplates() != null)) {
View Full Code Here

Examples of javax.persistence.EntityNotFoundException

        try {
            configurationDefinition = (ConfigurationDefinition) query.getSingleResult();
        } catch (NoResultException e) {
            ResourceType resourceType = entityManager.find(ResourceType.class, resourceTypeId);
            if (resourceType == null) {
                throw new EntityNotFoundException("A resource type with id " + resourceTypeId + " does not exist.");
            }
        }

        // Eager Load the templates
        if ((configurationDefinition != null) && (configurationDefinition.getTemplates() != null)) {
View Full Code Here

Examples of javax.persistence.EntityNotFoundException

  /*
   * Test method for
   * 'org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessException(PersistenceException)'
   */
  public void testConvertJpaPersistenceException() {
    EntityNotFoundException entityNotFound = new EntityNotFoundException();
    assertSame(JpaObjectRetrievalFailureException.class,
        EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(entityNotFound).getClass());

    NoResultException noResult = new NoResultException();
    assertSame(EmptyResultDataAccessException.class,
View Full Code Here

Examples of javax.persistence.EntityNotFoundException

    }

   public final T load(PK id) throws EntityNotFoundException {
        T entity = get(id);
        if (entity == null) {
            throw new EntityNotFoundException("entity " + entityClass + "#" + id + " was not found");
        }
        return entity;
    }
View Full Code Here

Examples of javax.persistence.EntityNotFoundException

        assertEntity(entityClass);

        AbstractClassMetaData acmd = om.getMetaDataManager().getMetaDataForClass(entityClass, om.getClassLoaderResolver());
        if (acmd == null)
        {
            throwException(new EntityNotFoundException());
        }

        Object pc;
        try
        {
View Full Code Here

Examples of javax.persistence.EntityNotFoundException

        {
            throw new IllegalArgumentException(LOCALISER.msg("EM.EntityIsNotManaged", StringUtils.toJVMIDString(entity)));
        }
        if (!om.exists(entity))
        {
            throwException(new EntityNotFoundException(LOCALISER.msg("EM.EntityNotInDatastore", StringUtils.toJVMIDString(entity))));
        }

        try
        {
            if (lock != null && lock != LockModeType.NONE)
View Full Code Here

Examples of javax.persistence.EntityNotFoundException

  // mimic specific exception aspects of the JPA environment ~~~~~~~~~~~~~~~~

  private static class JPAEntityNotFoundDelegate implements EntityNotFoundDelegate {
    public void handleEntityNotFound(String entityName, Serializable id) {
      throw new EntityNotFoundException("Unable to find " + entityName  + " with id " + id);     
    }
View Full Code Here

Examples of me.victorhernandez.hellospring.exception.EntityNotFoundException

    Query query = entityManager
        .createQuery("from Usuario as p where p.nombre = :username");
    query.setParameter("username", username);
    results = query.getResultList();
    if (results == null || results.size() <= 0) {
      throw new EntityNotFoundException(username + " not found");
    } else {
      return results.get(0);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.