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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:31:15+00:00 2026-05-31T12:31:15+00:00

I am using sequence for saving domain object instance in my oracle database. I

  • 0

I am using sequence for saving domain object instance in my oracle database.
I have a sequence for each table in the database.
when I use the save functionality on User or Resource for example, It created a new resource on first try but the ID used was 70 ? the sequence shows the proper next number – 42 since max id in the table is 41. why was id=70 used to insert the new resource?

Also from the next try all inserts fail with this error

org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL [insert into GRARESOURCE (decomm
issioned, disabled, criticality, resourceClass, resourceGroupId, resourceName, ownerId, resourceSegmentId, resourceTypeId, riskSco
re, targetIP, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [GRA.SYS_C0012183]; nested exception is org.hibernate.e
xception.ConstraintViolationException: Could not execute JDBC batch update

Not sure whats wrong because this is happening after code restructuring …where we moved code into new packages..

Edit: I found out the cause, see my response..Thanks guys

  • 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-31T12:31:16+00:00Added an answer on May 31, 2026 at 12:31 pm

    I realised the main cause of the problem.
    I had previously used the SequencePerTableOracleDialect, I got that from one of the previous posts by Burt Beckwith. The dialect creates a new sequence for each table when the application is starting up, similar to domain class converted to table.
    The dialect also makes sure that every tables id sequence is managed through its sequence only and a common sequence is not used for all inserts in the database (which is the default strategy)
    During the code restructuring I had removed the custom dialect and was using the default 10g dialect.

    Thats what was causing the problem!

    I see the next number in the tables associated sequence’s next value field, that where I come to know that the next val =42 for resource_sequence which is right since max(id) in resource table is 41.

    Thanks a lot guys for the insight which in some way help me recollect the real cause!
    for those who need to know more about the custom dialect,
    its Here

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

Sidebar

Related Questions

I'm using a Sequence to generate an id for me, but I use that
I'm using flex and have a few images that I need to sequence through.
In my app, I have a unique id for each object (tables). Now, because
I am using Generate Sequence Diagram feature of Visual Studio. I have to show
I am using filter to set the primary key of an instance before saving
I've a sequence defined in my Oracle database. Can I pull from this sequence
Why most hibernate application are using sequence for id generation? Why not use the
I am trying to implement protein pairwise sequence alignment using Global Alignment algorithm by
Apache Pig can load data from Hadoop sequence files using the PiggyBank SequenceFileLoader :
In Python, I'm constantly using the following sequence to get an integer value from

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.