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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:45:21+00:00 2026-06-11T14:45:21+00:00

I have an entity class with the following annotation on its primary key: @GeneratedValue(strategy

  • 0

I have an entity class with the following annotation on its primary key: @GeneratedValue(strategy = GenerationType.AUTO). However, when I try to persist an instance of this class, I get

com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name ‘OPENJPA_SEQUENCE_TABLE’.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)

The table it’s looking for definitely does not exist in the database. The user it’s connecting to the database as can create tables. Should it be creating OPENJPA_SEQUENCE_TABLE automatically, or do I have to do that for it? If so, what’s the table schema it’s expecting? I’m using openjpa-1.2.2.jar.

Edit: I looked at main()‘s JavaDoc since it has an option to add the sequence table on the command line, but org.apache.openjpa.jdbc.schema.TableJDBCSequence does not exist in openjpa-1.2.2.jar. org.apache.openjpa.jdbc.schema does, but TableJDBCSequence is not in it.

  • 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-11T14:45:23+00:00Added an answer on June 11, 2026 at 2:45 pm

    By default, OpenJPA doesn’t create any of the tables (including the sequence table) automatically unless you have the SynchronizeMappings property enabled in your persistence.xml. However, this is really only good for debugging purposes since I think it resets the database each time the application starts up:

    <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
    

    You can also use the OpenJPA MappingTool from the command line to generate the schema script:

    java org.apache.openjpa.jdbc.meta.MappingTool -action buildSchema -foreignKeys true
    

    More information about the Mapping Tool and runtime forward mapping is available here: http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_mapping.html#ref_guide_ddl_examples

    Your final option is to just create the table manually. Here is the script for Oracle; you can probably convert it to SQL Server fairly easily:

    CREATE TABLE openjpa_sequence_table (ID tinyint(4) NOT NULL, SEQUENCE_VALUE bigint(20) default NULL, PRIMARY KEY (ID)) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say, I have following entities: @Entity public class A { @Id @GeneratedValue private Long
I have written the following code: @Entity @Table(name=person) @Inheritance(strategy=InheritanceType.JOINED) public class Person { private
I have the following entity class : @Entity @Table(name = THE_TREE, catalog = ,
I have a JPA entity bean similar to the following: @Entity class License {
I have two entity classes annotated in the following way @Entity class A {
I have the following two entities: @Entity class Relation{ @ManyToOne private User user; //some
I have the following entities: @Entity public class Owner{ @Id @Column(name = OWNER_ID) @OneToMany()
I have the following classes: public class Entity<T> where T : Entity<T> { public
Suppose I have the following 2 entities: @Entity public class Person implements Serializable {
I have the following classes in my Model: public abstract class Entity : IEntity

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.