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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:59:12+00:00 2026-06-15T12:59:12+00:00

I am using Open JPA 2.0, WebSphere V8 and database is DB2 V10. Created

  • 0

I am using Open JPA 2.0, WebSphere V8 and database is DB2 V10.

Created sequence using below syntax

CREATE SEQUENCE “MYSCHEMA”.”SEQ_TABLEA” AS INTEGER START WITH 1
INCREMENT BY 1 MINVALUE 1000 MAXVALUE 2147483647 NO CYCLE CACHE 100
ORDER;

My Entity class definition uses sequence as below

@Entity
@Table(name="MYSCHEMA.SEQ_TABLEA")
public class MyEntity implements Serializable {

    @Id
    @SequenceGenerator(name="TABLEA_ID_GENERATOR", sequenceName="MYSCHEMA.SEQ_TABLEA")
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="TABLEA_GENERATOR")
    @Column(name="ID")
    private Integer myId;

    ..

After multiple inserts to TABLEA over 3 to 4 days, I find that sequence number has skipped many values. Inserts with sequence created are like 1,2,3,100,101,102,103,104,105,200,201,202,300,301,302,303,304,305,306,307,308,309,310,400,.. and so on

Any view on what is going wrong?
I did not find any error while inserting, neither the DB was bounced during this period.

  • 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-15T12:59:14+00:00Added an answer on June 15, 2026 at 12:59 pm

    Try setting the allocation size on the @SequenceGenerator annotation. This specifies the amount to increment when allocating sequence numbers.

    @SequenceGenerator(name="TABLEA_ID_GENERATOR", 
      sequenceName="MYSCHEMA.SEQ_TABLEA", allocationSize=1)
    

    Java API

    Good Article on Sequences in JPA

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

Sidebar

Related Questions

Using Open JPA 2.0, and database is DB2 9.7. I would like to like
Using Open JPA 2.0, Database is DB2 9.7. For query like SELECT COUNT(1) FROM
I'm using the IBM implentation of Open JPA on WebSphere 7 and I'm having
I am using Open JPA 2.0 - IBM implementation on WebSphere V8. I need
I am going to create an application using jsf 2.x, glassfish 3.1 open source,
I'm using WebSphere 7 and their JPA 2.0 implementation which is based on OpenJPA,
I am using openjpa (Websphere Application Server 7) to interact with the database. Is
I'm using WebSphere 7 (Java EE 5) and OpenJPA 1.2.1. I have a JPA
I am using JPA with openjpa implementation beneath, on a Geronimo application server. I
In pom.xml I have (taken from http://struberg.wordpress.com/2012/05/10/using-jpa-in-real-projects-part-1/ ): <properties> <openjpa.sql.action>refresh</openjpa.sql.action> <database.driver.name>org.postgresql.Driver</database.driver.name> <database.connection.url>jdbc:postgresql://myURL</database.connection.url> <database.user>user</database.user> <database.password>password</database.password>

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.