Using of ORACLE rowId in Hibernate Criteria

Description

I have ORACLE DB and 2 tables.
I need select rows from table1 inner join table2 and order by ORACLE RowID column.
To select I use criteria query.
To add order by statement I use

criteria.addOrder(Order.asc("this.rowId"));

In mapping RowId look like

<property name="rowId" column="ROWID" insert="false" update="false"/>

But hibernate generate wrong sql query like

select this_.docId as attr0_, this_.name as attr1_ from table1 this_ inner join table2 t2_ on this_.docId=t2_.docId order by ROWID asc

Hibernate drop alias "this" from query. Because all tables in ORACLE has ROWID column, we have oracle error ORA-00918

Hibernate drops alias because in org.hibernate.dialect.Oracle8iDialect "rowid" register as Function but "rowId" it's not a function. It a column and in query it must have table alias "order by this_.ROWID"

Activity

Jan SchattemanNovember 27, 2023 at 10:28 PM

This issue has been rejected since the Hibernate legacy Criteria API was deprecated in 5.x and removed in 6.0. There will be no further development for it.

MarkusAugust 13, 2016 at 9:37 AM
Edited

Simpy use your own dialect and intercept it in the registerFunction() method.
Or declare it as:

Steve EbersoleOctober 28, 2015 at 3:24 AM

As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.

Steve EbersoleOctober 27, 2015 at 7:16 PM

This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.

For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/

Максим МартыновMarch 4, 2013 at 3:41 PM

Tom Say about rowID

Out of Date

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Created March 4, 2013 at 3:38 PM
Updated November 27, 2023 at 10:28 PM
Resolved November 27, 2023 at 10:28 PM