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