Hibernate Oracle 12c 无法确定方言
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30455661/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Hibernate Oracle 12c unable to determine dialect
提问by user3249353
I am trying to connect to Oracle 12c using hibernate version 3.6.10.Final. When i do org.hibernate.cfg.configuration.buildSessionFactory()
我正在尝试使用休眠版本 3.6.10.Final 连接到 Oracle 12c。当我做 org.hibernate.cfg.configuration.buildSessionFactory()
I get
我得到
org.hibernate.HibernateException: Unable to determine Dialect to use [name=Oracle, majorVersion=12]; user must register resolver or explicitly set 'hibernate.dialect'.
org.hibernate.HibernateException:无法确定方言使用 [name=Oracle,majorVersion=12];用户必须注册解析器或明确设置“hibernate.dialect”。
When i am using Oracle 11g i don't have this problem the dialect is autodetected to org.hibernate.dialect.Oracle10gDialect. Why for Oracle 12c it doesn't work.
当我使用 Oracle 11g 时,我没有这个问题,方言会自动检测到 org.hibernate.dialect.Oracle10gDialect。为什么对于 Oracle 12c 它不起作用。
Thanks
谢谢
采纳答案by Grzegorz Kazior
Hibernate in your version cannot guess what dialect to use with Oracle12c. However, you may force to use Oracle10 dialect.
您的版本中的 Hibernate 无法猜测与 Oracle12c 一起使用的方言。但是,您可能会强制使用 Oracle10 方言。
Here is a spring configuration and the databasePlatform
property which does the job.
这是一个弹簧配置和databasePlatform
完成工作的属性。
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="generateDdl" value="true"/>
<property name="showSql" value="true" />
<!-- this property forces Oracle10 on Oracle12c since Hibernete cannot guess it! -->
<property name="databasePlatform" value="org.hibernate.dialect.Oracle10gDialect"/>
</bean>
</property>
回答by user3249353
Hibernate 3.6.10 doesn't support Oracle 12. StandardDialectResolver can't resolve the dialect for Oracle12
Hibernate 3.6.10 不支持 Oracle 12。StandardDialectResolver 无法解析 Oracle12 的方言