Oracle 数据库 11g 的 Hibernate 方言?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4369944/
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 dialect for Oracle Database 11g?
提问by Landon Kuhn
Is there a Hibernate dialect for Oracle Database 11g? Or should I use the org.hibernate.dialect.Oracle10gDialect
that ships with Hibernate?
Oracle 数据库 11g 是否有 Hibernate 方言?或者我应该使用org.hibernate.dialect.Oracle10gDialect
Hibernate 附带的那个?
回答by MJB
Use the Oracle 10g dialect. Also Hibernate 3.3.2+ is required for recent JDBC drivers (the internal class structure changed - symptoms will be whining about an abstract class).
使用 Oracle 10g 方言。最近的 JDBC 驱动程序也需要 Hibernate 3.3.2+(内部类结构发生了变化 - 症状会抱怨抽象类)。
Dialect of Oracle 11g is same as Oracle 10g (org.hibernate.dialect.Oracle10gDialect). Source: http://docs.jboss.org/hibernate/orm/3.6/reference/en-US/html/session-configuration.html#configuration-optional-dialects
Oracle 11g 的方言与 Oracle 10g ( org.hibernate.dialect.Oracle10gDialect) 相同。来源:http: //docs.jboss.org/hibernate/orm/3.6/reference/en-US/html/session-configuration.html#configuration-optional-dialects
回答by darioo
According to supported databases, Oracle 11g is not officially supported. Although, I believe you shouldn't have any problems using org.hibernate.dialect.OracleDialect
.
根据支持的数据库,Oracle 11g 不受官方支持。虽然,我相信您使用org.hibernate.dialect.OracleDialect
.
回答by Simone Cinti
We had a problem with the (deprecated) dialect org.hibernate.dialect.Oracledialect
and Oracle 11g database using hibernate.hbm2ddl.auto = validate
mode.
我们在org.hibernate.dialect.Oracledialect
使用hibernate.hbm2ddl.auto = validate
模式时遇到了(已弃用的)方言和 Oracle 11g 数据库的问题 。
With this dialect Hibernate was unable to found the sequences (because the implementation of the getQuerySequencesString()
method, that returns this query:
使用这种方言 Hibernate 无法找到序列(因为该getQuerySequencesString()
方法的实现 ,返回此查询:
"select sequence_name from user_sequences;"
"select sequence_name from user_sequences;"
for which the execution returns an empty result from database).
执行从数据库返回空结果)。
Using the dialect org.hibernate.dialect.Oracle9iDialect
, or greater, solves the problem, due to a different implementation of getQuerySequencesString()
method:
org.hibernate.dialect.Oracle9iDialect
由于getQuerySequencesString()
方法的不同实现,使用方言 或更高版本可以解决问题 :
"select sequence_name from all_sequences union select synonym_name from all_synonyms us, all_sequences asq where asq.sequence_name = us.table_name and asq.sequence_owner = us.table_owner;"
"select sequence_name from all_sequences union select synonym_name from all_synonyms us, all_sequences asq where asq.sequence_name = us.table_name and asq.sequence_owner = us.table_owner;"
that returns all the sequences if executed, instead.
如果执行,则返回所有序列。
回答by ibre5041
At least in case of EclipseLink 10g and 11g differ. Since 11g it is not recommended to use first_rows hint for pagination queries.
至少在 EclipseLink 10g 和 11g 的情况下是不同的。从 11g 开始,不建议对分页查询使用 first_rows 提示。
See "Is it possible to disable jpa hints per particular query". Such a query should not be used in 11g.
请参阅“是否可以禁用每个特定查询的 jpa 提示”。此类查询不应在 11g 中使用。
SELECT * FROM (
SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum FROM (
SELECT * FROM TABLES INCLUDING JOINS, ORDERING, etc.) a
WHERE ROWNUM <= 10 )
WHERE rnum > 0;
But there can be other nuances.
但可能还有其他细微差别。
回答by Mike3355
If you are using WL 10 use the following:
如果您使用 WL 10,请使用以下内容:
org.hibernate.dialect.Oracle10gDialect
org.hibernate.dialect.Oracle10gDialect
回答by Manish Khalde
use only org.hibernate.dialect.OracleDialect Remove 10g,9 etc.
只使用 org.hibernate.dialect.OracleDialect 删除 10g,9 等。