3.8.7.1. Datastore Identity Mapping

Object Identity describes how to use datastore identity in JPA. OpenJPA requires a single numeric primary key column to hold datastore identity values. The org.apache.openjpa.persistence.jdbc.DataStoreIdColumn annotation customizes the datastore identity column. This annotation has the following properties:

  • String name: Defaults to ID.

  • int precision

  • String columnDefinition

  • boolean insertable

  • boolean updatable

All properties correspond exactly to the same-named properties on the standard Column annotation, described in Column.

Example 115. Datastore Identity Mapping
import org.apache.openjpa.persistence.*;
import org.apache.openjpa.persistence.jdbc.*;

@Entity
@Table(name="LOGS")
@DataStoreIdColumn(name="ENTRY")
public class LogEntry {

    @Lob
    private String content;

    ...
}