问题描述
我的应用程序中使用了多个数据库,redshift是其中之一.由于使用hibernate框架配置连接,因此我尝试使用适当的方言进行redshift.但是 PostgreSQL9Dialect 和 MySQL5InnoDBDialect 都对我有用.
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.
好奇地知道哪种方言最适合Redshift?另外,我还有以下问题.
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?
推荐答案
由于Redshift
基于PostgreSQL 8.0.2(请参见此),最好使用PostgreSQL方言.由于PostgreSQL之间存在一些差异,因此在某些情况下它不起作用并不奇怪,但是您可以尝试一下.
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.
方言对于休眠是必需的.如果未指定方言,它将尝试根据从JDBC驱动程序获取的元数据来选择最适合您的方言.如果无法选择方言,它将抛出异常,说明 Unable to determine Dialect to use
.
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
.
这篇关于用于Redshift的休眠方言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!