0

I have a very simple JPA CRUD repository in my application:

@Repository
public interface SwaScParentCdfRepository extends CrudRepository<SwaScParentCdf, Long> {


}

Other JPA repositories work OK, but this one throws the following error when calling findAll or actually any method including native queries:

Caused by: org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:280)
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:233)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:551)
    at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
    at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
...
Caused by: org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x00
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)

Actually the table in the database is empty and it is a select, so I really don't understand it? It doesn't seem to be anything related with encoding. I don't understand the SQL [n/a] either which also seems to be at the root of the cause?

This one works fine:

@Repository
public interface MagScModificationRepository
        extends CrudRepository<MagScModification, Long>, JpaSpecificationExecutor<MagScModification> {

}

Would appreciate any pointers!

Thanks

2
  • Perhaps here you find smth valuable: stackoverflow.com/questions/1347646/… Commented Nov 18, 2023 at 12:39
  • Yes. That seems to have solved it. My doubt was why is a findAll triggering an insert? Commented Nov 18, 2023 at 21:06

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.