Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/UserGuide/JPA/Basic JPA Development/Entities/Creating and Configuring Entities"

Line 12: Line 12:
 
* [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/TableGenerator.html @TableGenerator]
 
* [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/TableGenerator.html @TableGenerator]
 
* [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/SequenceGenerator.html @SequenceGenerator ]
 
* [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/SequenceGenerator.html @SequenceGenerator ]
* [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/package-summary.html Package javax.persistence]
+
* [http://www.eclipse.org/eclipselink/api/latest/javax/persistence/package-summary.html Package javax.persistence]}}
 
+
}}
+
  
 
= Configuring Entities and Mappings=
 
= Configuring Entities and Mappings=
  
 +
An entity is a lightweight persistence domain object. Typically, an entity represents a table in a relational database, and each entity instance corresponds to a row in the table. The primary programming artifact of an entity is the entity class, although entities can use helper classes.
 +
 +
The persistent state of an entity is represented either through persistent fields or persistent properties. These fields or properties use object/relational mapping annotations to map the entities and entity relationships to the relational data in the underlying data store.
 +
 +
== Identifying an Entity ==
 +
Use the @Entity annotation to
 +
 +
{{EclipseLink_Spec
 +
|link=http://jcp.org/en/jsr/detail?id=220
 +
|section=Chapter 2 "Entities"}}
 +
 +
==Configuring an Entity's Persistent Identity==
 
Every entity must have a persistent identity, which is an equivalent of a primary key in a database table that stores the entity state.  
 
Every entity must have a persistent identity, which is an equivalent of a primary key in a database table that stores the entity state.  
  

Revision as of 14:55, 8 April 2011

EclipseLink JPA


Configuring Entities and Mappings

An entity is a lightweight persistence domain object. Typically, an entity represents a table in a relational database, and each entity instance corresponds to a row in the table. The primary programming artifact of an entity is the entity class, although entities can use helper classes.

The persistent state of an entity is represented either through persistent fields or persistent properties. These fields or properties use object/relational mapping annotations to map the entities and entity relationships to the relational data in the underlying data store.

Identifying an Entity

Use the @Entity annotation to

Elug javaspec icon.gif

For more information, see Chapter 2 "Entities" in the JPA Specification.

Configuring an Entity's Persistent Identity

Every entity must have a persistent identity, which is an equivalent of a primary key in a database table that stores the entity state.

By default, the EclipseLink persistence provider assumes that each entity has at least one field or property that serves as a primary key.

You can generate and/or configure the identity of your entities by using the following annotations:

You can also use these annotations to fine-tune how your database maintains the identity of your entities.



Eclipselink-logo.gif
Version: 2.2.0 DRAFT
Other versions...

Back to the top