All About Java

JPA Temporal Types

JPA Temporal Types

Temporal types are the set of time-based types which is used to represent datetime. It can be used in persistent state mappings.

JPA supports following temporal types includes the three java.sql types:

  1. java.sql.Date,
  2. java.sql.Time, and
  3. java.sql.Timestamp

And the two java.util types:

  1. java.util.Date and
  2. java.util.Calendar.

The @Temporal annotation is used to specify the Temporal Types.

@Temporal(TemporalType.DATE)
@Column(name="CreatedDate")
private Date cDate;

,

Comments are currently closed.

2 thoughts on “JPA Temporal Types