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 654893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:32:38+00:00 2026-05-13T22:32:38+00:00

suppose i have a sequence, called TEST_SEQ what would be the correct way of

  • 0

suppose i have a sequence, called TEST_SEQ
what would be the correct way of selecting its next value ?
this does not work:

select next value for TEST_SEQ

probably because it expects a “FROM” clause.
looking at HSQLDialect.getSequenceNextValString() in hibernate i see this:

"select next value for " + sequenceName + " from dual_" + sequenceName

which in my case would result in something like:

select next value for TEST_SEQ from dual_TEST_SEQ

which does not work for 2.0.0-rc8 (i only assume this works in pre-2.0 versions – havent verified)
I’ve come across a solution that involves creating a simple table with 1 row called DUAL, in which case this will work (oracle style):

select next value for TEST_SEQ from DUAL

but hsqldb does not come with this table out of the box, and im not sure how i can get hibernate to generate such a table on “first boot”.

Im thinking there has to be a way to get the next value for a sequence out of the box and im just missing it.
any ideas ?

  • 1 1 Answer
  • 0 Views
  • 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. Editorial Team
    Editorial Team
    2026-05-13T22:32:39+00:00Added an answer on May 13, 2026 at 10:32 pm

    suppose i have a sequence, called TEST_SEQ what would be the correct way of selecting its next value ?

    While the documentation says:

    The next value for a sequence can be included in SELECT, INSERT and UPDATE statements as in the following example:

    SELECT [...,] NEXT VALUE FOR <sequencename> [, ...] FROM <tablename>;
    

    the "correct" way (because simpler, because not involving a table like a dumb DUAL table that HSQLDB doesn’t have) would be:

    call NEXT VALUE FOR <sequence_name>;
    

    This appeared in 1.7.2 and this is actually how Hibernate handles sequences in the HSQLDialect of "recent" versions of Hibernate Core (see HHH-2839).

    And indeed, this is what I see in the HSQLDialect of hibernate-core-3.3.0.SP1.jar:

    public String getSequenceNextValString(String sequenceName) {
        return "call next value for " + sequenceName;
    }
    

    So my advice is: upgrade to a newer version of Hibernate, you are very likely using Hibernate Core 3.2.5 or prior.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have this (outrageously) simplified XML schema: <xsd:complexType name=Person> <xsd:sequence> <xsd:element ref=FirstName/> <xsd:element
Suppose I have this XmlSchema fragment: <xs:element name= A> <xs:complexType> <xs:sequence> <xs:element ref=A1 maxOccurs=1/>
Suppose I have value of 01010101 and it's canonical sequence of octets: 0x30 0x31
Suppose I have a sequence x1,x2,x3.....xn, and I want to find the longest continuous
Suppose I have a sequence of numbers: {n, n+1, n+2, ... n + m}
Suppose I have a bulleted list like this: * list item 1 * list
Suppose I have some schema: <xsd:schema ...> <xsd:element name=foo> <xsd:complexType> <xsd:sequence> <xsd:element name=fooElement type=xs:string
Let's suppose I have some method that returns a IEnumerable<int> object. This methods make
I have a postgres table like this: CREATE SEQUENCE seq; CREATE TABLE tbl (id
Suppose I have an increasing sequence of unsigned integers C[i] . As they increase,

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.