Shota
Shota

Reputation: 7330

org.hibernate.dialect.PostgreSQLDialect is deprecated

I've just added configuration for Hibernate to my application and IntelliJ Idea is complaining that this dialect is deprecated:

<property name="hibernate.dialect">
   org.hibernate.dialect.PostgreSQLDialect
</property> 

Does not seem to be a clear solution on the internet, any suggestions?

Upvotes: 46

Views: 86568

Answers (2)

YKun and coding
YKun and coding

Reputation: 323

with Hibernate 6 and above, simply use PostgreSQLDialect (again). The need to specify a version-specific dialect has been abstracted away, simplifying configuration while allowing Hibernate to adapt to the database version dynamically.

PostgreSQLDialect is intended to cover multiple versions of PostgreSQL, with internal mechanisms to adapt to specific version features.

Upvotes: 6

Tunaki
Tunaki

Reputation: 137104

You need to use org.hibernate.dialect.PostgreSQL82Dialect instead.

This is documented in PostgreSQLDialect Javadoc:

Deprecated.
use PostgreSQL82Dialect instead

Note however that you should use the dialect that best matches the PostgreSQL JDBC driver you are using (list here). For example, if you are using PostgreSQL 9.4 or later, use PostgreSQL94Dialect instead.

Upvotes: 71

Related Questions