Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be 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/Ids/Generating and Configuring Entity Identities"

m
Line 3: Line 3:
 
|toc=n
 
|toc=n
 
|eclipselink=y
 
|eclipselink=y
|eclipselinktype=JPA}}
+
|eclipselinktype=JPA}}  
=Entity 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/UserGuide/JPA/Basic JPA Development/Configuration/JPA/persistence.xml|EclipseLink persistence provider]] assumes that each entity has at least one field or property that serves as a primary key.
+
= Generating and Configuring Entity Identity =
  
You can generate and/or configure the identity of your entities by using the following annotations:
+
Every entity must have a persistent identity, which is an equivalent of a primary key in a database table that stores the entity state.
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/Id|@Id]]
+
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/IdClass|@IdClass]]
+
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/EmbeddedId|@EmbeddedId]]
+
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/GeneratedValue|@GeneratedValue]]
+
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/TableGenerator|@TableGenerator]]
+
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/SequenceGenerator|@SequenceGenerator ]]
+
  
You can also use these annotations to fine-tune how your database maintains the identity of your entities.
+
By default, the [[EclipseLink/UserGuide/JPA/Basic JPA Development/Configuration/JPA/persistence.xml|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:
 +
 
 +
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/Id|@Id]]
 +
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/IdClass|@IdClass]]
 +
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/EmbeddedId|@EmbeddedId]]
 +
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/GeneratedValue|@GeneratedValue]]
 +
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/TableGenerator|@TableGenerator]]
 +
*[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Entity/SequenceGenerator|@SequenceGenerator ]]
  
 +
You can also use these annotations to fine-tune how your database maintains the identity of your entities.
  
 +
<br>
  
 
{{EclipseLink_JPA
 
{{EclipseLink_JPA

Revision as of 11:45, 29 March 2011

EclipseLink JPA

Eclipselink-logo.gif
EclipseLink
Website
Download
Community
Mailing ListForumsIRCmattermost
Issues
OpenHelp WantedBug Day
Contribute
Browse Source


Generating and Configuring Entity 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