Package org.hibernate.exception

Examples of org.hibernate.exception.ConstraintViolationException


          throw new LockTimeoutException( message, sqlException, sql );
        }
        if ( 515 == errorCode && "ZZZZZ".equals( sqlState ) ) {
          // Attempt to insert NULL value into column; column does not allow nulls.
          final String constraintName = getViolatedConstraintNameExtracter().extractConstraintName( sqlException );
          return new ConstraintViolationException( message, sqlException, sql, constraintName );
        }
        return null;
      }
    };
  }
View Full Code Here


    else if ( DataTruncation.class.isInstance( sqlException ) ||
        SQLDataException.class.isInstance( sqlException ) ) {
      throw new DataException( message, sqlException, sql );
    }
    else if ( SQLIntegrityConstraintViolationException.class.isInstance( sqlException ) ) {
      return new ConstraintViolationException(
          message,
          sqlException,
          sql,
          getConversionContext().getViolatedConstraintNameExtracter().extractConstraintName( sqlException )
      );
View Full Code Here

      if ( INTEGRITY_VIOLATION_CATEGORIES.contains( errorCode ) ) {
        String constraintName =
            getConversionContext()
                .getViolatedConstraintNameExtracter()
                .extractConstraintName( sqlException );
        return new ConstraintViolationException( message, sqlException, sql, constraintName );
      }
      else if ( DATA_CATEGORIES.contains( sqlStateClassCode ) ) {
        return new DataException( message, sqlException, sql );
      }
    }
View Full Code Here

        // 462 - failed on update or delete by foreign key constraint violation
        if ( errorCode == 287 || errorCode == 301 || errorCode == 461 || errorCode == 462 ) {
          final String constraintName = getViolatedConstraintNameExtracter().extractConstraintName(
              sqlException );

          return new ConstraintViolationException( message, sqlException, sql, constraintName );
        }

        return null;
      }
    };
View Full Code Here

        // data integrity violation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        if ( 1407 == errorCode ) {
          // ORA-01407: cannot update column to NULL
          final String constraintName = getViolatedConstraintNameExtracter().extractConstraintName( sqlException );
          return new ConstraintViolationException( message, sqlException, sql, constraintName );
        }

        return null;
      }
    };
View Full Code Here

          }

          if ( 90006 == errorCode ) {
            // NULL not allowed for column [90006-145]
            final String constraintName = getViolatedConstraintNameExtracter().extractConstraintName( sqlException );
            return new ConstraintViolationException( message, sqlException, sql, constraintName );
          }

          return null;
        }
      };
View Full Code Here

                    }

          if ( 90006 == errorCode ) {
            // NULL not allowed for column [90006-145]
            final String constraintName = getViolatedConstraintNameExtracter().extractConstraintName( sqlException );
            exception = new ConstraintViolationException( message, sqlException, sql, constraintName );
          }

          return exception;
        }
      };
View Full Code Here

          throw new LockTimeoutException( message, sqlException, sql );
        }
        if ( 515 == errorCode && "ZZZZZ".equals( sqlState ) ) {
          // Attempt to insert NULL value into column; column does not allow nulls.
          final String constraintName = getViolatedConstraintNameExtracter().extractConstraintName( sqlException );
          return new ConstraintViolationException( message, sqlException, sql, constraintName );
        }
        return null;
      }
    };
  }
View Full Code Here

        // data integrity violation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        if ( 1407 == errorCode ) {
          // ORA-01407: cannot update column to NULL
          final String constraintName = getViolatedConstraintNameExtracter().extractConstraintName( sqlException );
          return new ConstraintViolationException( message, sqlException, sql, constraintName );
        }

        return null;
      }
    };
View Full Code Here

        }
        else if ( INTEGRITY_VIOLATION_CATEGORIES.contains( sqlStateClassCode ) ) {
          final String constraintName = getConversionContext()
              .getViolatedConstraintNameExtracter()
              .extractConstraintName( sqlException );
          return new ConstraintViolationException( message, sqlException, sql, constraintName );
        }
        else if ( CONNECTION_CATEGORIES.contains( sqlStateClassCode ) ) {
          return new JDBCConnectionException( message, sqlException, sql );
        }
        else if ( DATA_CATEGORIES.contains( sqlStateClassCode ) ) {
View Full Code Here

TOP

Related Classes of org.hibernate.exception.ConstraintViolationException

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.