Class ScriptStatementFailedException
- java.lang.Object
- java.lang.Throwable
- java.lang.Exception
- java.lang.RuntimeException
- org.springframework.core.NestedRuntimeException
- org.springframework.dao.DataAccessException
- org.springframework.jdbc.datasource.init.ScriptException
- org.springframework.jdbc.datasource.init.ScriptStatementFailedException
- All Implemented Interfaces:
Serializable
public class ScriptStatementFailedException extends ScriptException
Thrown byScriptUtils
if a statement in an SQL script failed when executing it against the target database.- Since:
- 3.0.5
- Author:
- Juergen Hoeller, Sam Brannen
- See Also:
- Serialized Form
Constructor Summary
Constructors Constructor Description ScriptStatementFailedException(String stmt, int stmtNumber, EncodedResource encodedResource, Throwable cause)
Construct a newScriptStatementFailedException
.
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
buildErrorMessage(String stmt, int stmtNumber, EncodedResource encodedResource)
Build an error message for an SQL script execution failure, based on the supplied arguments.Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Constructor Detail
ScriptStatementFailedException
public ScriptStatementFailedException(String stmt, int stmtNumber, EncodedResource encodedResource, Throwable cause)
Construct a newScriptStatementFailedException
.- Parameters:
stmt
- the actual SQL statement that failedstmtNumber
- the statement number in the SQL script (i.e., the nth statement present in the resource)encodedResource
- the resource from which the SQL statement was readcause
- the underlying cause of the failure
Method Detail
buildErrorMessage
public static String buildErrorMessage(String stmt, int stmtNumber, EncodedResource encodedResource)
Build an error message for an SQL script execution failure, based on the supplied arguments.- Parameters:
stmt
- the actual SQL statement that failedstmtNumber
- the statement number in the SQL script (i.e., the nth statement present in the resource)encodedResource
- the resource from which the SQL statement was read- Returns:
- an error message suitable for an exception's detail message or logging
- Since:
- 4.2