diff --git a/samples/spring-data-jdbc/src/main/java/com/google/cloud/spanner/sample/JdbcConfiguration.java b/samples/spring-data-jdbc/src/main/java/com/google/cloud/spanner/sample/JdbcConfiguration.java index 2066647b5..a5c24adcd 100644 --- a/samples/spring-data-jdbc/src/main/java/com/google/cloud/spanner/sample/JdbcConfiguration.java +++ b/samples/spring-data-jdbc/src/main/java/com/google/cloud/spanner/sample/JdbcConfiguration.java @@ -64,7 +64,7 @@ public static boolean isCloudSpannerPG(JdbcOperations operations) { "The selected Cloud Spanner database does not use the PostgreSQL dialect"); } catch (DataAccessException exception) { if (exception.getCause() instanceof JdbcSqlException) { - JdbcSqlException jdbcSqlException = (JdbcSqlException) exception; + JdbcSqlException jdbcSqlException = (JdbcSqlException) exception.getCause(); if (jdbcSqlException.getCode() == Code.PERMISSION_DENIED || jdbcSqlException.getCode() == Code.NOT_FOUND) { throw new RuntimeException(