In my Spring Boot application I need to store bit masks into a table column with the goal of performing bit-wise queries against that column.
I have a domain class with a Long id field and a mask field containing the bit mask. I cannot figure out how to map it to a table containing a auto-generated long "id" column and a BIT VARYING (100) "mask" column.
I am using default Hibernate mapping. When I defined mask as a String in Java, I got a "PSQLException: column "mask" is of type bit varying but expression is of type character varying" error.
When I defined the mask as a Java BitSet, PostgresSQL gave me a similar error only for the bytea Postgres type.
Is there a way to map a Java field to BIT VARYING field? Can it be done using default persistence? Or do I have to override the CRUD methods to cast between BIT VARYING and some Java type?