Skip to content

Introduce SQL script exception hierarchy [SPR-11564] #16188

@spring-projects-issues

Description

@spring-projects-issues

Sam Brannen opened SPR-11564 and commented

Status Quo

The org.springframework.jdbc.datasource.init package contains several exceptions related to reading, parsing, and executing SQL scripts; however, each of these exceptions extends RuntimeException. Thus there is no clean way to catch and handle all types of script-related exceptions.

As a side effect of refactoring, #14165 already unified the exception hierarchy within org.springframework.jdbc.datasource.init package by introducing a common ScriptException base class that extends RuntimeException, but this doesn't go far enough. ScriptException should actually extend DataAccessException to allow callers to handle all data access related exceptions in a single catch block.

Deliverables

  1. Refactor ScriptException so that it extends DataAccessException.
  2. Favor unchecked ScriptExceptions over checked SQLExceptions whenever feasible.

Affects: 4.0.2

Issue Links:

Referenced from: commits fbd2546, 92eb99a

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions