Skip to main content
Jump to: navigation, search

Difference between revisions of "EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Temporal"

Line 44: Line 44:
|previous=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Enumerated|Enumerated]]
|previous=[[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Enumerated|@Enumerated]]
|next=    [[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Lob|Lob]]
|next=    [[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Lob|@Lob]]
|up=      [[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings|Basic Mappings]]
|up=      [[EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings|Basic Mappings]]
|version=2.2.0 DRAFT}}
|version=2.2.0 DRAFT}}

Revision as of 11:05, 10 February 2011

EclipseLink JPA

Mailing ListForumsIRCmattermost
OpenHelp WantedBug Day
Browse Source


Use the @Temporal annotation to specify the database type that EclipseLink persistence provider should persist for persistent fields or properties of type java.util.Date and java.util.Calendar only.

You can use this annotation with the @Basic annotation.

The @Temporal annotation has the following attributes:
Attribute Description Default Required?
value Set this attribute to the TemporalType that corresponds to database type you want EclipseLink persistence provider to use:
  • DATE – equivalent of java.sql.Date
  • TIME – equivalent of java.time.Date
  • TIMESTAMP – equivalent of java.sql.Timestamp

This example shows how to use this annotation to specify that EclipseLink persistence provider should persist java.util.Date field startDate as a DATE (java.sql.Date) database type.

Usage of the @Temporal Annotation

 public class Employee implements Serializable{
     protected java.util.Date startDate;
Elug javaspec icon.gif

For more information, see Section 9.1.20 "Temporal Annotation" in the JPA Specification.

Version: 2.2.0 DRAFT
Other versions...

Back to the top