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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:47:24+00:00 2026-06-09T23:47:24+00:00

I have the follwoing sequence defined in oracle: CREATE SEQUENCE MySequence MINVALUE 65536 MAXVALUE

  • 0

I have the follwoing sequence defined in oracle:

CREATE SEQUENCE MySequence
MINVALUE 65536 
MAXVALUE 4294967296 
START WITH 65536
INCREMENT BY 1
CYCLE
NOCACHE
ORDER;

I wonder how can I access this via Hibernate (the next value each time i request) ? (via JDBC i have used getGEnerateKeys)

I need the id before I use it on another entity that needs to be persisted.

Thanks

  • 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-06-09T23:47:26+00:00Added an answer on June 9, 2026 at 11:47 pm

    For Oracle you should use GenerationType.SEQUENCE

      @Id
        @GeneratedValue(generator="MySequence", strategy=GenerationType.SEQUENCE)
        @SequenceGenerator(allocationSize=1, name="MySequence", sequenceName="MySequence")
    

    Edit: sequencename updated

    Edit: refer to your comment:
    Your requirement sounds like composit/embedded id (using multiple columns as primary key) using sequence. but unfortunately both solution doesnt support sequence generator. So far I can say;

    *You can create a native query via hibernate and append to index number using ‘select mySequence.nextval from dual.

    *Or you can create an oracle view for that with the new column which is showing sequence + index via subquery.

    *This one very experimental and I didnt try but you can use @formula annotation. Example here.

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

Sidebar

Related Questions

I have the following sequence: [as seen now in Toad]: CREATE SEQUENCE LOG_ID_SEQ START
I have the following table and sequence in my postgresql-8.4 database: CREATE TABLE complexobjectpy
I have an entity defined with a sequence-generated primary key: @Id @GeneratedValue(strategy = GenerationType.SEQUENCE,
Say I have an index defined as follows: CREATE NONCLUSTERED INDEX [IX_Marker] ON [dbo].[Marker]
I have a sequence defined in my database that I want to use in
I'm a newbie to regular expressions and I have the following string: sequence =
I have integrated in Hudson a maven 3 project calling following sequence: clean tomcat:redeploy
I have the following: <xs:schema> <xs:complexType name=NameType> <xs:sequence> <xs:element name=NamePrefix type=core:NamePrefixType minOccurs=0/> <xs:element name=FirstName
I have the following xsd snippet: <xs:complexType name=HighSchoolType> <xs:sequence> <xs:element name=OrganizationName type=core:OrganizationNameType/> <xs:group ref=core:OrganizationIDGroup
I have the follwoing form in my view : I have an instance variable

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.