Package org.springframework.dao

Examples of org.springframework.dao.DataIntegrityViolationException


  public void testTransformWithExceptionAndNoRollback() throws Exception {
    processor.setItemProcessor(new ItemProcessor<String, String>() {
      @Override
      public String process(String item) throws Exception {
        if (item.equals("1")) {
          throw new DataIntegrityViolationException("Planned");
        }
        return item;
      }
    });
    processor.setProcessSkipPolicy(new AlwaysSkipItemSkipPolicy());
View Full Code Here


            log.debug("Processing key: " + key);
          }
          if (!changeSet.getValues().containsKey(key)) {
            String className = (String) dbo.get(ENTITY_FIELD_CLASS);
            if (className == null) {
              throw new DataIntegrityViolationException("Unble to convert property " + key + ": Invalid metadata, "
                  + ENTITY_FIELD_CLASS + " not available");
            }
            Class<?> clazz = ClassUtils.resolveClassName(className, ClassUtils.getDefaultClassLoader());
            Object value = mongoTemplate.getConverter().read(clazz, dbo);
            if (log.isDebugEnabled()) {
View Full Code Here

        // Ensure there isn't an existing record for this recipient
        long permissionId = lookupPermissionId(aclDetailsHolder.getForeignKeyId(),
                basicAclEntry.getRecipient());

        if (permissionId != -1) {
            throw new DataIntegrityViolationException("Recipient '"
                + basicAclEntry.getRecipient()
                + "' already exists for aclObjectIdentity ID "
                + aclDetailsHolder.getForeignKeyId() + " (permission ID " + ")");
        }
View Full Code Here

 
  protected void validate(E value) throws DataIntegrityViolationException {
    try {
      validationManager.validate(value);
    } catch (BindException bindException) {
      throw new DataIntegrityViolationException("Entity state is invalid", bindException);
    }
  }
View Full Code Here

        user.setEmail("matt@raibledesigns.com");
        List users;
        users = new ArrayList();

        users.add(user);
        Exception ex = new DataIntegrityViolationException("");
        userDao.expects(once()).method("saveUser").with(same(user))
               .will(throwException(ex));
       
        // run test
        try {
View Full Code Here

    }
    if (ex instanceof OptimisticLockException) {
      return new JpaOptimisticLockingFailureException((OptimisticLockException) ex);
    }
    if (ex instanceof EntityExistsException) {
      return new DataIntegrityViolationException(ex.getMessage(), ex);
    }
    if (ex instanceof TransactionRequiredException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
View Full Code Here

    }
    if (ex instanceof LockAcquisitionException) {
      return new CannotAcquireLockException(ex.getMessage(), ex);
    }
    if (ex instanceof ConstraintViolationException) {
      return new DataIntegrityViolationException(ex.getMessage(), ex);
    }
    if (ex instanceof JDBCException) {
      return new HibernateJdbcException((JDBCException) ex);
    }
    if (ex instanceof PropertyValueException) {
      return new DataIntegrityViolationException(ex.getMessage(), ex);
    }
    if (ex instanceof PersistentObjectException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof TransientObjectException) {
View Full Code Here

   */
  @SuppressWarnings("deprecation")
  public static DataAccessException convertGemfireAccessException(GemFireException ex) {
    if (ex instanceof CacheException) {
      if (ex instanceof CacheExistsException) {
        return new DataIntegrityViolationException(ex.getMessage(), ex);
      }
      if (ex instanceof CommitConflictException) {
        return new DataIntegrityViolationException(ex.getMessage(), ex);
      }
      if (ex instanceof CommitIncompleteException) {
        return new DataIntegrityViolationException(ex.getMessage(), ex);
      }
      if (ex instanceof EntryExistsException) {
        return new DuplicateKeyException(ex.getMessage(), ex);
      }
      if (ex instanceof EntryNotFoundException) {
        return new DataRetrievalFailureException(ex.getMessage(), ex);
      }
      if (ex instanceof RegionExistsException) {
        return new DataIntegrityViolationException(ex.getMessage(), ex);
      }
    }
    if (ex instanceof CacheRuntimeException) {
      if (ex instanceof CacheXmlException) {
        return new GemfireSystemException(ex);
View Full Code Here

            if (log.isDebugEnabled()) log.debug("User-defined constructor called on class " + entity.getClass() + "; created Node [" + getPersistentState() + "]; Updating metamodel");
            template.postEntityCreation(node, type);
        } catch (NotInTransactionException e) {
            throw new InvalidDataAccessResourceUsageException("Not in a Neo4j transaction.", e);
        } catch (ConstraintViolationException e) {
            throw new DataIntegrityViolationException(e.getMessage(),e);
        }
    }
View Full Code Here

                    propertyContainer.removeProperty(propertyName);
                } else {
                    propertyContainer.setProperty(propertyName, newVal);
                }
            } catch(ConstraintViolationException cve) {
                throw new DataIntegrityViolationException("Unique constraint violated "+property.getOwner().getName()+"."+property.getName()+" new value "+newVal,cve);
            }
            return newVal;
        }
View Full Code Here

TOP

Related Classes of org.springframework.dao.DataIntegrityViolationException

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.