Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 125723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:12:15+00:00 2026-05-11T05:12:15+00:00

I have a complicated HQL query. I would like to access the Oracle specific

  • 0

I have a complicated HQL query.

I would like to access the Oracle specific rownum column value as part of my returned results. How do I write my query (and/or change my hbm.xml) to support this?

What I have tried so far does not work:

modifying my hbm.xml

<property name='rownum' type='int' update='false' insert='false' generated='never'/> 

and a query such as:

'select dog.rownum from Dog as dog where ...' 

But I get java.sql.SQLException: ORA-01747: invalid user.table.column, table.column, or column specification

I suspect I might need to mix some sql with my complex hql query… suggestions welcome. Thanks.


Some background:

  • http://ronfrancis.wordpress.com/2007/10/16/dont-forget-an-order-by-for-pagination-queries/
  • hibernate uses oracle’s rownum ‘under the hood’ to paginate results.
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:12:16+00:00Added an answer on May 11, 2026 at 5:12 am

    ROWNUM doesn’t belong to any table, so your query should be:

    'select rownum from Dog as dog where ...' 

    For example:

    SQL> select emp.ename, rownum from emp;  ENAME          ROWNUM ---------- ---------- SMITH               1 ALLEN               2 WARD                3 JONES               4 MARTIN              5 BLAKE               6 CLARK               7 SCOTT               8 KING                9 TURNER             10 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rather complicated function the I would like to write as an
Ok SQL and Oracle gurus I have a somewhat complicated query that I'm trying
I have a pretty complicated Linq query that I can't seem to get into
I have a set of core, complicated JavaScript data structures/classes that I'd like to
I have a complicated MS SQL 2005 query with a PIVOT in it... I
I have quite a complicated ListView . Each item looks something like this: >
I have a fairly complicated join query that I use with my database. Upon
This is probably quite trivial but.... I have a quite complicated linq query that
I have some really complicated legacy code I've been working on that crashes when
I have a somewhat complicated branching structure at work (at least for me). It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.