Package org.springframework.dao

Examples of org.springframework.dao.DataIntegrityViolationException


      String classCode = sqlState.substring(0, 2);
      if (BAD_SQL_CODES.contains(classCode)) {
        return new BadSqlGrammarException(task, sql, ex);
      }
      else if (INTEGRITY_VIOLATION_CODES.contains(classCode)) {
        return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex);
      }
      else if (RESOURCE_FAILURE_CODES.contains(classCode)) {
        return new DataAccessResourceFailureException(buildMessage(task, sql, ex), ex);
      }
      else if (CONCURRENCY_CODES.contains(classCode)) {
View Full Code Here


          logTranslation(task, sql, sqlExToUse, false);
          return new PermissionDeniedDataAccessException(buildMessage(task, sql, sqlExToUse), sqlExToUse);
        }
        else if (Arrays.binarySearch(this.sqlErrorCodes.getDataIntegrityViolationCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlExToUse, false);
          return new DataIntegrityViolationException(buildMessage(task, sql, sqlExToUse), sqlExToUse);
        }
        else if (Arrays.binarySearch(this.sqlErrorCodes.getCannotAcquireLockCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlExToUse, false);
          return new CannotAcquireLockException(buildMessage(task, sql, sqlExToUse), sqlExToUse);
        }
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

      LockAcquisitionException jdbcEx = (LockAcquisitionException) ex;
      return new CannotAcquireLockException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex);
    }
    if (ex instanceof ConstraintViolationException) {
      ConstraintViolationException jdbcEx = (ConstraintViolationException) ex;
      return new DataIntegrityViolationException(ex.getMessage()  + "; SQL [" + jdbcEx.getSQL() +
          "]; constraint [" + jdbcEx.getConstraintName() + "]", ex);
    }
    if (ex instanceof DataException) {
      DataException jdbcEx = (DataException) ex;
      return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", 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

      LockAcquisitionException jdbcEx = (LockAcquisitionException) ex;
      return new CannotAcquireLockException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex);
    }
    if (ex instanceof ConstraintViolationException) {
      ConstraintViolationException jdbcEx = (ConstraintViolationException) ex;
      return new DataIntegrityViolationException(ex.getMessage()  + "; SQL [" + jdbcEx.getSQL() +
          "]; constraint [" + jdbcEx.getConstraintName() + "]", ex);
    }
    if (ex instanceof DataException) {
      DataException jdbcEx = (DataException) ex;
      return new DataIntegrityViolationException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", 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

    }
    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

    KeyHolder kh = executeInsertAndReturnKeyHolderInternal(values);
    if (kh != null && kh.getKey() != null) {
      return kh.getKey();
    }
    else {
      throw new DataIntegrityViolationException("Unable to retreive the generated key for the insert: " +
          getInsertString());
    }
  }
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

    KeyHolder kh = executeInsertAndReturnKeyHolderInternal(values);
    if (kh != null && kh.getKey() != null) {
      return kh.getKey();
    }
    else {
      throw new DataIntegrityViolationException("Unable to retrieve the generated key for the insert: " +
          getInsertString());
    }
  }
View Full Code Here

    KeyHolder kh = executeInsertAndReturnKeyHolderInternal(values);
    if (kh != null && kh.getKey() != null) {
      return kh.getKey();
    }
    else {
      throw new DataIntegrityViolationException("Unable to retreive the generated key for the insert: " +
          getInsertString());
    }
  }
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.