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.
Difference between revisions of "EclipseLink/UserGuide/JPA/Basic JPA Development/Mapping/Basic Mappings/Temporal"
< EclipseLink | UserGuide | JPA | Basic JPA Development | Mapping | Basic Mappings
(→@Temporal) |
(→@Temporal) |
||
Line 20: | Line 20: | ||
<td>Set this attribute to the <tt>TemporalType</tt> that corresponds to database type you want EclipseLink persistence provider to use: | <td>Set this attribute to the <tt>TemporalType</tt> that corresponds to database type you want EclipseLink persistence provider to use: | ||
* <tt>DATE</tt> – equivalent of <tt>java.sql.Date</tt> | * <tt>DATE</tt> – equivalent of <tt>java.sql.Date</tt> | ||
− | * <tt>TIME</tt> – equivalent of <tt>java. | + | * <tt>TIME</tt> – equivalent of <tt>java.sql.Time</tt> |
* <tt>TIMESTAMP</tt> – equivalent of <tt>java.sql.Timestamp</tt></td> | * <tt>TIMESTAMP</tt> – equivalent of <tt>java.sql.Timestamp</tt></td> | ||
<td></td> | <td></td> |
Revision as of 11:55, 27 October 2011
EclipseLink JPA
EclipseLink | |
Website | |
Download | |
Community | |
Mailing List • Forums • IRC • mattermost | |
Issues | |
Open • Help Wanted • Bug Day | |
Contribute | |
Browse Source |
Key API
@Temporal
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.
Attribute | Description | Default | Required? |
---|---|---|---|
value | Set this attribute to the TemporalType that corresponds to database type you want EclipseLink persistence provider to use:
|
Yes |
The following 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.
Example: @Temporal Annotation
@Entity public class Employee implements Serializable{ ... @Temporal(DATE) protected java.util.Date startDate; ... }
For more information, see Section 11.1.47 "Temporal Annotation" in the JPA Specification.
@Enumerated | @Lob | |
EclipseLink Home
JPA User Guide: Table of Contents, Search |
||
How to contribute to this guide... |