org.springframework.jdbc
Class BadSqlGrammarException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.lang.RuntimeException
                    |
                    +--org.springframework.core.NestedRuntimeException
                          |
                          +--org.springframework.dao.DataAccessException
                                |
                                +--org.springframework.dao.InvalidDataAccessResourceUsageException
                                      |
                                      +--org.springframework.jdbc.BadSqlGrammarException

public class BadSqlGrammarException
extends InvalidDataAccessResourceUsageException

Exception thrown when SQL specified is invalid. Such exceptions always have a java.sql.SQLException root cause.

It would be possible to have subclasses for no such table, no such column etc. A custom SQLExceptionTranslator could create such more specific exceptions, without affecting code using this class.

Author:
Rod Johnson
Version: $Id: BadSqlGrammarException.java,v 1.1 2003/12/05 17:02:36 jhoeller Exp $

Constructor Summary
BadSqlGrammarException(String task, String sql, SQLException ex)
          Constructor for BadSqlGrammarException.

Method Summary
 StringgetSql()
          Return the SQL that caused the problem.
 SQLExceptiongetSQLException()
          Return the wrapped SQLException.

Methods inherited from class org.springframework.core.NestedRuntimeException
getCause, getMessage, printStackTrace, printStackTrace

Methods inherited from class java.lang.Throwable
printStackTrace, getStackTrace, setStackTrace, getLocalizedMessage, toString, fillInStackTrace, initCause

Methods inherited from class java.lang.Object
hashCode, notify, notifyAll, wait, wait, wait, getClass, equals

Constructor Detail

BadSqlGrammarException

public BadSqlGrammarException(String task, String sql, SQLException ex)
Constructor for BadSqlGrammarException.
Parameters:
task - name of current task (may be null)
sql - the offending SQL statement
ex - the root cause
Method Detail

getSql

public String getSql()
Return the SQL that caused the problem.
Returns: the offdending SQL

getSQLException

public SQLException getSQLException()
Return the wrapped SQLException.
Returns: the wrapped SQLException

Association Links

to Class java.sql.SQLException

Root cause: underlying JDBC exception.

to Class java.lang.String

The offending SQL.