Package org.springframework.jdbc.support

Examples of org.springframework.jdbc.support.SQLExceptionTranslator


  private static final long serialVersionUID = -2450323227461061152L;

  @Override
  public void exception(ExecuteContext ctx) {
    SQLDialect dialect = ctx.configuration().dialect();
    SQLExceptionTranslator translator = (dialect != null) ? new SQLErrorCodeSQLExceptionTranslator(dialect.name())
        : new SQLStateSQLExceptionTranslator();

    ctx.exception(translator.translate("jOOQ", ctx.sql(), ctx.sqlException()));
  }
View Full Code Here


    private static final long serialVersionUID = -2450323227461061152L;

    @Override
    public void exception(ExecuteContext ctx) {
        SQLDialect dialect = ctx.configuration().dialect();
        SQLExceptionTranslator translator = (dialect != null)
                ? new SQLErrorCodeSQLExceptionTranslator(dialect.name())
                : new SQLStateSQLExceptionTranslator();

        ctx.exception(translator.translate("jOOQ", ctx.sql(), ctx.sqlException()));
    }
View Full Code Here

   * @return the corresponding DataAccessException instance
   * @see #setJdbcExceptionTranslator
   * @see org.hibernate.Session#connection()
   */
  protected DataAccessException convertJdbcAccessException(SQLException ex) {
    SQLExceptionTranslator translator = getJdbcExceptionTranslator();
    if (translator == null) {
      translator = getDefaultJdbcExceptionTranslator();
    }
    return translator.translate("Hibernate-related JDBC operation", null, ex);
  }
View Full Code Here

    public static final String SQL = "no_sproc_with_this_name";

    public StoredProcedureExceptionTranslator(DataSource ds) {
      setDataSource(ds);
      setSql(SQL);
      getJdbcTemplate().setExceptionTranslator(new SQLExceptionTranslator() {
        public DataAccessException translate(
          String task,
          String sql,
          SQLException sqlex) {
          return new CustomDataException(sql, sqlex);
View Full Code Here

    public static final String SQL = "no_sproc_with_this_name";

    public StoredProcedureExceptionTranslator(DataSource ds) {
      setDataSource(ds);
      setSql(SQL);
      getJdbcTemplate().setExceptionTranslator(new SQLExceptionTranslator() {

        @Override
        public DataAccessException translate(String task, String sql,
            SQLException sqlex) {
          return new CustomDataException(sql, sqlex);
View Full Code Here

   * @param ex the SQLException
   * @return the corresponding DataAccessException instance
   * @see #setJdbcExceptionTranslator
   */
  protected DataAccessException convertJdbcAccessException(SQLException ex) {
    SQLExceptionTranslator translator = getJdbcExceptionTranslator();
    if (translator == null) {
      translator = getDefaultJdbcExceptionTranslator();
    }
    return translator.translate("Hibernate-related JDBC operation", null, ex);
  }
View Full Code Here

   * @return the corresponding DataAccessException instance
   * @see #setJdbcExceptionTranslator
   * @see org.hibernate.Session#connection()
   */
  protected DataAccessException convertJdbcAccessException(SQLException ex) {
    SQLExceptionTranslator translator = getJdbcExceptionTranslator();
    if (translator == null) {
      translator = getDefaultJdbcExceptionTranslator();
    }
    return translator.translate("Hibernate-related JDBC operation", null, ex);
  }
View Full Code Here

      // Execute given callback...
      try {
        return session.queryForList(queryId, parameters);
      }
      catch (SQLException ex) {
        SQLExceptionTranslator sqlStateSQLExceptionTranslator;

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

        throw sqlStateSQLExceptionTranslator.translate("SqlMapClient operation", null, ex);
      }
      finally {
        try {
          if (springCon != null) {
            if (transactionAware) {
View Full Code Here

        } catch (BatchException e) {
          throw e.getBatchUpdateException();
        }
      }
      catch (SQLException ex) {
        SQLExceptionTranslator sqlStateSQLExceptionTranslator;

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

        throw sqlStateSQLExceptionTranslator.translate("SqlMapClient operation", null, ex);
      }

      // Processing finished - potentially session still to be closed.
    }
    finally {
View Full Code Here

TOP

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

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.