Package org.hibernate

Examples of org.hibernate.JDBCException


            stmt.executeUpdate( formatted );
          }
        }
        catch ( SQLException e ) {
          if ( haltOnError ) {
            throw new JDBCException( "Error during DDL export", e );
          }
          exceptions.add( e );
                    LOG.unsuccessful(sql);
                    LOG.error(e.getMessage());
        }
View Full Code Here


  public static PageException toPageException(Throwable t) {
    if (!(t instanceof JDBCException))
      return caster().toPageException(t);
   
   
    JDBCException j = (JDBCException)t;
    String message = j.getMessage();
    Throwable cause = j.getCause();
    if(cause != null) {
      message += " [" + cause.getMessage() + "]";
    }
    return CFMLEngineFactory.getInstance().getExceptionUtil().createDatabaseException(message, new SQLImpl(j.getSQL()));
   
  }
View Full Code Here

            stmt.executeUpdate( formatted );
          }
        }
        catch ( SQLException e ) {
          if ( haltOnError ) {
            throw new JDBCException( "Error during DDL export", e );
          }
          exceptions.add( e );
                    LOG.unsuccessful(sql);
                    LOG.error(e.getMessage());
        }
View Full Code Here

      // expected
      assertEquals(dex, ex.getCause());
      assertTrue(ex.getMessage().contains("mymsg"));
    }

    final JDBCException jdex = new JDBCException("mymsg", sqlEx);
    try {
      hibernateTemplate.execute(new HibernateCallback<Object>() {
        @Override
        public Object doInHibernate(Session session)  {
          throw jdex;
View Full Code Here

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

    final JDBCException jdex = new JDBCException("mymsg", sqlEx);
    try {
      hibernateTemplate.execute(new HibernateCallback<Object>() {
        @Override
        public Object doInHibernate(org.hibernate.Session session) throws HibernateException {
          throw jdex;
View Full Code Here

   * @see SessionFactoryUtils#convertHibernateAccessException
   * @see #setJdbcExceptionTranslator
   */
  protected DataAccessException convertHibernateAccessException(HibernateException ex) {
    if (this.jdbcExceptionTranslator != null && ex instanceof JDBCException) {
      JDBCException jdbcEx = (JDBCException) ex;
      return this.jdbcExceptionTranslator.translate(
          "Hibernate operation: " + jdbcEx.getMessage(), jdbcEx.getSQL(), jdbcEx.getSQLException());
    }
    return SessionFactoryUtils.convertHibernateAccessException(ex);
  }
View Full Code Here

    if (delegate == null) {
      delegate = new SQLExceptionConversionDelegate() {

        @Override
        public JDBCException convert(SQLException sqlException, String message, String sql) {
                    JDBCException exception = null;

                    int errorCode = JdbcExceptionHelper.extractErrorCode(sqlException);

                    if (40001 == errorCode) { // DEADLOCK DETECTED
                        exception = new LockAcquisitionException(message, sqlException, sql);
View Full Code Here

   * @see SessionFactoryUtils#convertHibernateAccessException
   * @see #setJdbcExceptionTranslator
   */
  protected DataAccessException convertHibernateAccessException(HibernateException ex) {
    if (this.jdbcExceptionTranslator != null && ex instanceof JDBCException) {
      JDBCException jdbcEx = (JDBCException) ex;
      return this.jdbcExceptionTranslator.translate(
          "Hibernate operation: " + jdbcEx.getMessage(), jdbcEx.getSQL(), jdbcEx.getSQLException());
    }
    return SessionFactoryUtils.convertHibernateAccessException(ex);
  }
View Full Code Here

      fail("INSERT should have failed");
    }
    catch(SQLException sqle) {
      JDBCExceptionReporter.logExceptions(sqle, "Just output!!!!");
      JDBCException jdbcException = converter.convert(sqle, null, null);
      assertEquals( "Bad conversion [" + sqle.getMessage() + "]", ConstraintViolationException.class , jdbcException.getClass() );
      ConstraintViolationException ex = (ConstraintViolationException) jdbcException;
      System.out.println("Violated constraint name: " + ex.getConstraintName());
    }
    finally {
      if ( ps != null ) {
View Full Code Here

    SQLExceptionConversionDelegate delegate = super.buildSQLExceptionConversionDelegate();
    if (delegate == null) {
      delegate = new SQLExceptionConversionDelegate() {
        @Override
        public JDBCException convert(SQLException sqlException, String message, String sql) {
          JDBCException exception = null;
         
          if (exception == null) {
            String sqlState = JdbcExceptionHelper.extractSqlState(sqlException);
           
            if ("40P01".equals(sqlState)) { // DEADLOCK DETECTED
View Full Code Here

TOP

Related Classes of org.hibernate.JDBCException

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.