Hello,
I am trying to map a postgres bytea value to a java byte[].
This is my table:
This is what it contains:
My DAO has this method:
@SqlQuery("SELECT ba from my_test fetch first 1 row only")
byte[] selectBytea();
But when I execute it, I get:
... Caused by: org.postgresql.util.PSQLException: Bad value for type byte : \x01 at org.postgresql.jdbc.PgResultSet.getByte(PgResultSet.java:2135) at org.jdbi.v3.core.mapper.PrimitiveMapperFactory.lambda$primitiveMapper$0(PrimitiveMapperFactory.java:64) at org.jdbi.v3.core.mapper.SingleColumnMapper.lambda$new$0(SingleColumnMapper.java:41) at org.jdbi.v3.core.mapper.SingleColumnMapper.map(SingleColumnMapper.java:55) at org.jdbi.v3.core.result.ResultSetResultIterator.next(ResultSetResultIterator.java:83)
Does anyone know what is going on?
I have also posted this question here on SO.
I am wondering if the wrong mapper is being used? ResultSet::getByte when it should be ResultSet::getBytes?