Hibernate UUID issues on Postgres 10

After updating a database from Postgres 9.6 to 10 all applications stopped working. The error message in the server log file is “Unable to load requested class: pg-uuid”. 

Setup

The software stack in use is

  • Wildfly 10 with Hibernate 5.0.16 (also tested with Wildfly 11 with Hibernate 5.1.10)
  • PostgreSQL JDBC driver 42.1.4
  • PostgreSQL Server 9.6 updated to PostgreSQL Server 10.1

In the entity I have the following annotations

Problem

While running on PostgreSQL 9.6 the application was running fine. After the upgrade to 10.1 the application stopped working. The cause is an  exception during startup deployment:

Solution

I have not found the root cause yet, but I was able to resolve the issue. by adding the following line to the application’s persistence.xml.

Dialects of Hibernate 5.0 / 5.1 which is used in Wildfly 10 / 11 supports max up to PostgreSQL94Dialect. PostgreSQL95Dialect has been added in Hibernate 5.2