EntityGraph with order by using Oracle10gDialect

Description

Using EntityGraphs with Oracle generates incorrect SQL when "order by" clause is added. The same query works correctly in other databases, like HSQL.

I have prepared simple test case:
https://github.com/yuppyavd/hibernate-test-entitygraph/

There are four tests:

  • hsql entitygraph without order by: PASSED

  • oracle entitygraph without order by: PASSED

  • hsql entitygraph with order by: PASSED

  • oracle entitygraph with order by: FAILED

Environment

Hibernate 4.3.6
Oracle 10g/11g

Activity

Show:
Piotr Ostrowski
October 25, 2014, 4:31 PM

When I changed Oracle10gDialect method "createOuterJoinFragment" to return OracleJoinFragment instead of ANSIJoinFragment, it generates correct SQL and passing test.

SQL Generated with OracleJoinFragment:

Piotr Ostrowski
October 27, 2014, 10:21 AM
Edited

Ok, I have found it!

Oracle8iDialect overrides a method "getCrossJoinSeparator":

Oracle 8i does not support ANSI "CROSS JOIN". From 9i "CROSS JOIN" is supported. I have overriden "getCrossJoinSeparator" method in Oracle10gDialect to return original value from org.hibernate.dialect.Dialect class:

It works now with ANSIJoinFragment and Oracle 10g database.

Can someone add a fix to Oracle dialect class?

Gail Badner
February 18, 2015, 9:37 PM

I've also see this with out using ORDER BY when applying the pull request for and running the tests using Oracle 10g

Gail Badner
February 23, 2015, 9:37 PM

Fixed in master and 4.3 branches.

Gail Badner
April 15, 2015, 9:48 PM

Closing in preparation of releasing 4.3.9.Final and 4.2.19.Final.

Assignee

Gail Badner

Reporter

Piotr Ostrowski

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure