org.springframework.jdbc.support

Class AbstractFallbackSQLExceptionTranslator

  • java.lang.Object
    • org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator
    • Field Detail

      • logger

        protected final Log logger
        Logger available to subclasses.
    • Constructor Detail

      • AbstractFallbackSQLExceptionTranslator

        public AbstractFallbackSQLExceptionTranslator()
    • Method Detail

      • doTranslate

        @Nullable
        protected abstract DataAccessException doTranslate(java.lang.String task,
                                                                     @Nullable
                                                                     java.lang.String sql,
                                                                     java.sql.SQLException ex)
        Template method for actually translating the given exception.

        The passed-in arguments will have been pre-checked. Furthermore, this method is allowed to return null to indicate that no exception match has been found and that fallback translation should kick in.

        Parameters:
        task - readable text describing the task being attempted
        sql - the SQL query or update that caused the problem (if known)
        ex - the offending SQLException
        Returns:
        the DataAccessException, wrapping the SQLException; or null if no exception match found
      • buildMessage

        protected java.lang.String buildMessage(java.lang.String task,
                                                @Nullable
                                                java.lang.String sql,
                                                java.sql.SQLException ex)
        Build a message String for the given SQLException.

        To be called by translator subclasses when creating an instance of a generic DataAccessException class.

        Parameters:
        task - readable text describing the task being attempted
        sql - the SQL statement that caused the problem
        ex - the offending SQLException
        Returns:
        the message String to use