107

Is there a Hibernate dialect for Oracle Database 11g? Or should I use the org.hibernate.dialect.Oracle10gDialect that ships with Hibernate?

OMG Ponies
  • 325,700
  • 82
  • 523
  • 502
Landon Kuhn
  • 76,451
  • 45
  • 104
  • 130

5 Answers5

117

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).

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

Community
  • 1
  • 1
MJB
  • 9,352
  • 6
  • 34
  • 49
  • 2
    Unfortunately does not help for "ORA-01754: a table may contain only one column of type LONG". – Jan Goyvaerts Mar 06 '13 at 10:52
  • I have a problem with specific reserved function INTERVAL.. e.g " @Formula(" SYSDATE - INTERVAL '1' HOUR * SHOW_LIMIT_HOURS ") " . I don´t know it is could generate some issue, but seem to be a good solution: http://stackoverflow.com/a/26907699/1488761 – Eduardo Fabricio Aug 14 '15 at 14:39
14

According to supported databases, Oracle 11g is not officially supported. Although, I believe you shouldn't have any problems using org.hibernate.dialect.OracleDialect.

darioo
  • 46,442
  • 10
  • 75
  • 103
  • 18
    Mind that `org.hibernate.dialect.OracleDialect` is deprecated ( http://docs.jboss.org/hibernate/core/3.6/javadocs/org/hibernate/dialect/OracleDialect.html). You should use the Oracle 10g dialect. – Yonatan Jan 03 '12 at 12:57
  • 9
    Oracle 11 is now supported – MJB Jul 25 '12 at 03:11
  • 8
    As @MJB pointed out Oracle 11 is supported. The missing part is : it is supported with org.hibernate.dialect.Oracle10gDialect class [link](http://docs.jboss.org/hibernate/orm/3.6/reference/en-US/html/session-configuration.html#configuration-optional-dialects) (applies to hiernate 4.x too) – bmichalik Dec 17 '13 at 12:53
4

We had a problem with the (deprecated) dialect org.hibernate.dialect.Oracledialect and Oracle 11g database using hibernate.hbm2ddl.auto = validate mode.

With this dialect Hibernate was unable to found the sequences (because the implementation of the getQuerySequencesString() method, that returns this query:

"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:

"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.

2

At least in case of EclipseLink 10g and 11g differ. Since 11g it is not recommended to use first_rows hint for pagination queries.

See "Is it possible to disable jpa hints per particular query". Such a query should not be used in 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.

Community
  • 1
  • 1
ibre5041
  • 4,903
  • 1
  • 20
  • 35
0

If you are using WL 10 use the following:

org.hibernate.dialect.Oracle10gDialect

Mike3355
  • 11,305
  • 24
  • 96
  • 184