ObjectDB ObjectDB

Internal Website Search

1-10 of 62 resultsRefresh


javax.persistence Enum GenerationType java.lang.Object java.lang.Enum<javax.persistence.GenerationType> javax.persistence.GenerationType Implemented Interfaces: Serializable, Comparable<GenerationType> Defines the types of primary key generation strategies. Since: JPA 1.0


Static Method javax.persistence.GenerationType GenerationType[] values() Returns an array containing the constants of this enum type. This method may be used to iterate over the constants as follows: for (GenerationType c : GenerationType.values()) System.out.println(c) Returns: an array


Static Method javax.persistence.GenerationType GenerationType valueOf( String name ) Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. Parameters: name - the name of the enum constant


Enum Constant javax.persistence.GenerationType TABLE Indicates that the persistence provider must assign primary keys for the entity using an underlying database table to ensure uniqueness. Since: JPA 1.0


Enum Constant javax.persistence.GenerationType SEQUENCE Indicates that the persistence provider must assign primary keys for the entity using a database sequence. Since: JPA 1.0


Enum Constant javax.persistence.GenerationType IDENTITY Indicates that the persistence provider must assign primary keys for the entity using a database identity column. Since: JPA 1.0


Enum Constant javax.persistence.GenerationType AUTO Indicates that the persistence provider should pick an appropriate strategy for the particular database. The AUTO generation strategy may expect a database resource to exist, or it may attempt to create one. A vendor may provide documentation

JPA Annotations for Value Generation

Automatically generated values are mainly useful for primary key fields, but are supported by ObjectDB also for regular (non primary key) persistent fields. At the field level, the @GeneratedValue with an optional GenerationType strategy is specified: The @GeneratedValue annotation

Auto Generated Values

(strategy=GenerationType.AUTO) long id; : } AUTO is the default strategy, so the following ... @GeneratedValue(strategy=GenerationType.IDENTITY) long id; : } The IDENTITY strategy ... above: @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="seq") @Id long id; } Unlike AUTO


: "" Since: JPA 1.0 GenerationType strategy (Optional) The primary key generation strategy ... key. Default value: javax.persistence.GenerationType.AUTO Since: JPA 1.0

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