Package org.hibernate.exception

Examples of org.hibernate.exception.DataException


        || SQLTransientConnectionException.class.isInstance( sqlException ) ) {
      return new JDBCConnectionException( message, sqlException, sql );
    }
    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,
View Full Code Here


                .getViolatedConstraintNameExtracter()
                .extractConstraintName( sqlException );
        return new ConstraintViolationException( message, sqlException, sql, constraintName );
      }
      else if ( DATA_CATEGORIES.contains( sqlStateClassCode ) ) {
        return new DataException( message, sqlException, sql );
      }
    }
    return null; // allow other delegates the chance to look
  }
View Full Code Here

        }
        else if ( CONNECTION_CATEGORIES.contains( sqlStateClassCode ) ) {
          return new JDBCConnectionException( message, sqlException, sql );
        }
        else if ( DATA_CATEGORIES.contains( sqlStateClassCode ) ) {
          return new DataException( message, sqlException, sql );
        }
      }

      if ( "40001".equals( sqlState ) ) {
        return new LockAcquisitionException( message, sqlException, sql );
View Full Code Here

        || SQLTransientConnectionException.class.isInstance( sqlException ) ) {
      return new JDBCConnectionException( message, sqlException, sql );
    }
    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,
View Full Code Here

        }
        else if ( CONNECTION_CATEGORIES.contains( sqlStateClassCode ) ) {
          return new JDBCConnectionException( message, sqlException, sql );
        }
        else if ( DATA_CATEGORIES.contains( sqlStateClassCode ) ) {
          return new DataException( message, sqlException, sql );
        }
      }

      if ( "40001".equals( sqlState ) ) {
        return new LockAcquisitionException( message, sqlException, sql );
View Full Code Here

        || SQLTransientConnectionException.class.isInstance( sqlException ) ) {
      return new JDBCConnectionException( message, sqlException, sql );
    }
    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,
View Full Code Here

      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) {
View Full Code Here

      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) {
View Full Code Here

      // expected
      assertEquals(cvex, ex.getCause());
      assertTrue(ex.getMessage().indexOf("mymsg") != -1);
    }

    final DataException dex = new DataException("mymsg", sqlEx);
    try {
      createTemplate().execute(new HibernateCallback() {
        public Object doInHibernate(org.hibernate.Session session) throws HibernateException {
          throw dex;
        }
View Full Code Here

      }
      else if ( CONNECTION_CATEGORIES.contains( sqlStateClassCode ) ) {
        return new JDBCConnectionException( message, sqlException, sql );
      }
      else if ( DATA_CATEGORIES.contains( sqlStateClassCode ) ) {
        return new DataException( message, sqlException, sql );
      }
    }
    return handledNonSpecificException( sqlException, message, sql );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.exception.DataException

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.