Hibernate 5.2.7 is affected, at least the Postgres Dialect. I built an example on how this gives unexpected results with Native Queries & Spring Data JPA: https://github.com/RobertRad/spring-data-hibernate-postgres-bigint