Package org.hibernate.exception

Examples of org.hibernate.exception.LockAcquisitionException


      // it indicates sql states starting with '40' and that those usually indicate that:
      //    <quote>
      //      the current statement was automatically rolled back by the database because of deadlock or
      //       other transaction serialization failures.
      //    </quote>
      return new LockAcquisitionException( message, sqlException, sql );
    }

    return null; // allow other delegates the chance to look
  }
View Full Code Here


          return new DataException( message, sqlException, sql );
        }
      }

      if ( "40001".equals( sqlState ) ) {
        return new LockAcquisitionException( message, sqlException, sql );
      }

      if ( "61000".equals( sqlState ) ) {
        // oracle sql-state code for deadlock
        return new LockAcquisitionException( message, sqlException, sql );
      }

      if ( "40XL1".equals( sqlState ) || "40XL2".equals( sqlState )) {
        // Derby "A lock could not be obtained within the time requested."
        return new PessimisticLockException( message, sqlException, sql );
View Full Code Here

      // it indicates sql states starting with '40' and that those usually indicate that:
      //    <quote>
      //      the current statement was automatically rolled back by the database because of deadlock or
      //       other transaction serialization failures.
      //    </quote>
      return new LockAcquisitionException( message, sqlException, sql );
    }

    return null; // allow other delegates the chance to look
  }
View Full Code Here

    if (ex instanceof SQLGrammarException) {
      SQLGrammarException jdbcEx = (SQLGrammarException) ex;
      return new InvalidDataAccessResourceUsageException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex);
    }
    if (ex instanceof LockAcquisitionException) {
      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) {
View Full Code Here

    if (ex instanceof SQLGrammarException) {
      SQLGrammarException jdbcEx = (SQLGrammarException) ex;
      return new InvalidDataAccessResourceUsageException(ex.getMessage() + "; SQL [" + jdbcEx.getSQL() + "]", ex);
    }
    if (ex instanceof LockAcquisitionException) {
      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) {
View Full Code Here

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

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

        if ( "41000".equals( sqlState ) ) {
          return new LockTimeoutException( message, sqlException, sql );
        }

        if ( "40001".equals( sqlState ) ) {
          return new LockAcquisitionException( message, sqlException, sql );
        }

        return null;
      }
    };
View Full Code Here

                    JDBCException exception = null;

                    int errorCode = JdbcExceptionHelper.extractErrorCode(sqlException);

                    if (40001 == errorCode) { // DEADLOCK DETECTED
                        exception = new LockAcquisitionException(message, sqlException, sql);
                    }

                    if (50200 == errorCode) { // LOCK NOT AVAILABLE
                        exception = new PessimisticLockException(message, sqlException, sql);
                    }
View Full Code Here

      @Override
      public JDBCException convert(SQLException sqlException, String message, String sql) {
        final String sqlState = JdbcExceptionHelper.extractSqlState( sqlException );

        if ( "40P01".equals( sqlState ) ) { // DEADLOCK DETECTED
          return new LockAcquisitionException( message, sqlException, sql );
        }

        if ( "55P03".equals( sqlState ) ) { // LOCK NOT AVAILABLE
          return new PessimisticLockException( message, sqlException, sql );
        }
View Full Code Here

          return new DataException( message, sqlException, sql );
        }
      }

      if ( "40001".equals( sqlState ) ) {
        return new LockAcquisitionException( message, sqlException, sql );
      }

      if ( "61000".equals( sqlState ) ) {
        // oracle sql-state code for deadlock
        return new LockAcquisitionException( message, sqlException, sql );
      }

      if ( "40XL1".equals( sqlState ) || "40XL2".equals( sqlState )) {
        // Derby "A lock could not be obtained within the time requested."
        return new PessimisticLockException( message, sqlException, sql );
View Full Code Here

TOP

Related Classes of org.hibernate.exception.LockAcquisitionException

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.