Skip to content

CassandraExceptionTranslator doesn't match contract of PersistenceExceptionTranslator #1155

@warper321

Description

@warper321

Spring data cassandra version: 3.2.3

Hi, I have a case where I'm running a spring boot app with spring data while connecting to both an oracle and a cassandra instance. I noticed an error when testing a method that throws NoResultException, that instead of getting translated to an EmptyResultDataAccessException (like it did before I added spring data cassandra), it instead got translated to CassandraUncategorizedException. I think this is because org.springframework.data.cassandra.core.cql.CassandraExceptionTranslator returns CassandraUncategorizedException instead of null when the contract for PersistenceExceptionTranslator says

Do not translate exceptions that are not understood by this translator: for example, if coming from another persistence framework, or resulting from user code or otherwise unrelated to persistence.

Since the cassandra translator happens to get inserted first in line before the one for oracle hibernate no exceptions ever reach it and all persistence exceptions are now considered to be Cassandra exceptions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions