Package org.springframework.jdbc.support

Examples of org.springframework.jdbc.support.SQLStateSQLExceptionTranslator


      given(resultSetMetaData.getColumnLabel(3)).willReturn("birth_date");
      given(resultSetMetaData.getColumnLabel(4)).willReturn("balance");

      jdbcTemplate = new JdbcTemplate();
      jdbcTemplate.setDataSource(new SingleConnectionDataSource(connection, false));
      jdbcTemplate.setExceptionTranslator(new SQLStateSQLExceptionTranslator());
      jdbcTemplate.afterPropertiesSet();
    }
View Full Code Here


    given(this.connection.createStatement()).willReturn(this.preparedStatement);

    JdbcTemplate template = new JdbcTemplate();
    template.setDataSource(this.dataSource);
    // Set custom exception translator
    template.setExceptionTranslator(new SQLStateSQLExceptionTranslator());
    template.afterPropertiesSet();

    this.thrown.expect(BadSqlGrammarException.class);
    this.thrown.expect(exceptionCause(sameInstance(sqlException)));
    try {
View Full Code Here

  public static SQLExceptionTranslator newJdbcExceptionTranslator(SessionFactory sessionFactory) {
    DataSource ds = getDataSource(sessionFactory);
    if (ds != null) {
      return new SQLErrorCodeSQLExceptionTranslator(ds);
    }
    return new SQLStateSQLExceptionTranslator();
  }
View Full Code Here

public class SpringExceptionTranslator implements com.mysema.query.sql.SQLExceptionTranslator {

    private final SQLExceptionTranslator translator;
   
    public SpringExceptionTranslator() {
        this.translator = new SQLStateSQLExceptionTranslator();
    }
View Full Code Here

    // Check for PersistenceManagerFactory's DataSource.
    if (connectionFactory instanceof DataSource) {
      return new SQLErrorCodeSQLExceptionTranslator((DataSource) connectionFactory);
    }
    else {
      return new SQLStateSQLExceptionTranslator();
    }
  }
View Full Code Here

      if (exceptionTranslator == null) {
        if (dataSource != null) {
          exceptionTranslator = new SQLErrorCodeSQLExceptionTranslator(dataSource);
        }
        else {
          exceptionTranslator = new SQLStateSQLExceptionTranslator();
        }
      }
    }
    return exceptionTranslator;
  }
View Full Code Here

      }
      catch (SQLException ex) {
        SQLExceptionTranslator sqlStateSQLExceptionTranslator;

        if(dataSource != null) {
          sqlStateSQLExceptionTranslator = new SQLStateSQLExceptionTranslator();
        } else {
          sqlStateSQLExceptionTranslator = new SQLErrorCodeSQLExceptionTranslator(dataSource);
        }

        throw sqlStateSQLExceptionTranslator.translate("SqlMapClient operation", null, ex);
View Full Code Here

      }
      catch (SQLException ex) {
        SQLExceptionTranslator sqlStateSQLExceptionTranslator;

        if(dataSource != null) {
          sqlStateSQLExceptionTranslator = new SQLStateSQLExceptionTranslator();
        } else {
          sqlStateSQLExceptionTranslator = new SQLErrorCodeSQLExceptionTranslator(dataSource);
        }

        throw sqlStateSQLExceptionTranslator.translate("SqlMapClient operation", null, ex);
View Full Code Here

  public static SQLExceptionTranslator newJdbcExceptionTranslator(SessionFactory sessionFactory) {
    DataSource ds = getDataSource(sessionFactory);
    if (ds != null) {
      return new SQLErrorCodeSQLExceptionTranslator(ds);
    }
    return new SQLStateSQLExceptionTranslator();
  }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.support.SQLStateSQLExceptionTranslator

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.