Search code examples
javahibernatejdbc

Hibernate dialect for Redshift


There are multiple databases used in my application and redshift is one of them. Because of using hibernate framework for configuring the connections I am trying to use appropriate dialect for redshift. But both PostgreSQL9Dialect and MySQL5InnoDBDialect are working for me.

Curious to know which dialect is best for Redshift? Also, I have below questions.

Is dialect mandatory while using hibernate?

What is the default dialect if nothing is mentioned?


Solution

  • As Redshift is based on PostgreSQL 8.0.2 (see this) , it is better to use PostgreSQL dialect. Since it has some differences between PostgreSQL, it is not surprise that it will not work for some cases but you could have a try.

    Dialect is mandatory for hibernate . If you do not specify a dialect , it will try to choose the most suitable one for you based on the metadata get from the JDBC driver. If no dialect can be chosen , it will throw an exception saying that Unable to determine Dialect to use.