Integrate Spanner with Hibernate ORM (PostgreSQL dialect)

Hibernate is an object-relational mapping tool for the Java programming language. It provides a framework for mapping an object-oriented domain model to a relational database.

You can integrate PostgreSQL-dialect databases with Hibernate using the open source PostgreSQL JDBC Driver. Hibernate ORM 6.3 is supported with PostgreSQL-dialect databases.

Set up PGAdapter

Ensure that PGAdapter is running on the same machine as the application that is using Hibernate.

For more information, see Start PGAdapter.

Set up Hibernate with PostgreSQL

In your project, add Apache Maven dependencies for the Hibernate ORM core and PostgreSQL JDBC Driver.

<!-- Hibernate core dependency -->

<!-- Postgresql JDBC driver dependency -->

Set up Hibernate properties

Configure to use the PostgreSQL dialect and PostgreSQL JDBC Driver.





# validate

Use Hibernate

For more information about the features and recommendations for integrating Hibernate with PostgreSQL-dialect databases, please consult the reference documentation on GitHub.

What's next