ObjectDB ObjectDB

Internal Website Search

1-10 of 27 resultsRefresh

@SequenceGenerator and single id in whole database

Hi, I have a question about @SequenceGenerator. I have separate @SequenceGenerator in each ... classes: By using multiple @SequenceGenerator and/or @TableGenerator definitions (with different name ... the part about strategy type. Each of my model class got following annotations: @SequenceGenerator


javax.persistence Annotation SequenceGenerator Target: Classes and fields (including property get methods) Defines a primary key generator that may be referenced by name when a generator element ... to the persistence unit (across all generator types). Example: @SequenceGenerator(name="EMP_SEQ


Annotation Element javax.persistence.SequenceGenerator String sequenceName (Optional) The name of the database sequence object from which to obtain primary key values. Defaults to a provider-chosen value. Default value: "" Since: JPA 1.0


Annotation Element javax.persistence.SequenceGenerator String schema (Optional) The schema of the sequence generator. Default value: "" Since: JPA 2.0


Annotation Element javax.persistence.SequenceGenerator String name (Required) A unique generator name that can be referenced by one or more classes to be the generator for primary key values. Since: JPA 1.0


Annotation Element javax.persistence.SequenceGenerator int initialValue (Optional) The value from which the sequence object is to start generating. Default value: 1 Since: JPA 1.0


Annotation Element javax.persistence.SequenceGenerator String catalog (Optional) The catalog of the sequence generator. Default value: "" Since: JPA 2.0


Annotation Element javax.persistence.SequenceGenerator int allocationSize (Optional) The amount to increment by when allocating sequence numbers from the sequence. Default value: 50 Since: JPA 1.0

Auto Generated Values

and using the named sequence in one or more fields in one or more classes. The @SequenceGenerator ... a sequence - might also be in another class: @SequenceGenerator(name="seq", initialValue=1, allocationSize ... sequence numbers to start with 1 in the TABLE strategy initialValue=0 has to be specified in the @SequenceGenerator annotation.

JPA Annotations for Value Generation

Reference (JavaDoc) of JPA 2 value generation annotations, including @GeneratedValue, @SequenceGenerator and @TableGenerator.

Getting Started

ObjectDB is very easy to use. Follow the Getting Started Tutorial and the Quick Tour manual chapter and in minutes you may be able to write and run first Java programs against ObjectDB.

Prior knowledge or experience in database programming (SQL, JDBC, ORM, JPA, etc.) is not required, but some background in using the Java language is essential.

Need Help?

  1. Search ObjectDB website
  2. Read the FAQ
  3. Follow the Tutorials
  4. View or post in the forum
  5. Search or file an issue
  6. Contact support