Landon Kuhn
Landon Kuhn

Reputation: 78421

Hibernate dialect for Oracle Database 11g?

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

Upvotes: 110

Views: 261980

Answers (6)

Joy
Joy

Reputation: 631

Providing latest development on this. SpringBoot-3.1.4 doesn't require Dialect and JDBC driver to explicitly configure. It's take care of automatically.

You can remove following lines from application.properties

spring.datasource.driver.class-name=oracle.jdbc.OracleDriver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect

Only following properties are sufficient:

spring.datasource.url=****
spring.datasource.username=***
spring.datasource.password=****

Upvotes: 0

MJB
MJB

Reputation: 9399

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

Upvotes: 120

ibre5041
ibre5041

Reputation: 5288

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.

Upvotes: 2

Mike3355
Mike3355

Reputation: 12081

If you are using WL 10 use the following:

org.hibernate.dialect.Oracle10gDialect

Upvotes: 0

Simone Cinti
Simone Cinti

Reputation: 41

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.

Upvotes: 4

darioo
darioo

Reputation: 47183

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

Upvotes: 15

Related Questions