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:
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
When I changed Oracle10gDialect method "createOuterJoinFragment" to return OracleJoinFragment instead of ANSIJoinFragment, it generates correct SQL and passing test.
SQL Generated with OracleJoinFragment:
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?
I've also see this with out using ORDER BY when applying the pull request for and running the tests using Oracle 10g
Fixed in master and 4.3 branches.
Closing in preparation of releasing 4.3.9.Final and 4.2.19.Final.