- Developing Middleware in Java EE 8
- Abdalla Mahmoud
- 111字
- 2021-07-23 19:24:38
Date and time mapping
In a typical relational database, there are three basic data types for columns:
- Date
- Time
- Timestamp
All of these three data types are represented in Java as an instance of the java.util.Date class. To make this clear for mapping by the persistence provider, the @Termporal annotation should be used to identify which one of the three database types should be selected. The following example shows how the @Temportal annotation is used:
@Entity public class Movie { @Temporal(TemporalType.DATE) private Date releaseDate; }
The following values are available for the @Termporal annotation:
- TemporalType.DATE: Date-only values
- TemporalType.TIME: Time-only values
- TemporalType.TIMESTAMP: Date with time values
推薦閱讀
- 數(shù)據(jù)庫(kù)系統(tǒng)原理及MySQL應(yīng)用教程(第2版)
- Python科學(xué)計(jì)算(第2版)
- Learning Chef
- Vue.js 3.x從入門到精通(視頻教學(xué)版)
- Python網(wǎng)絡(luò)爬蟲從入門到實(shí)踐(第2版)
- Python應(yīng)用輕松入門
- Java EE 7 Development with NetBeans 8
- C++面向?qū)ο蟪绦蛟O(shè)計(jì)習(xí)題解答與上機(jī)指導(dǎo)(第三版)
- 零基礎(chǔ)入門學(xué)習(xí)Python(第2版)
- 常用工具軟件立體化教程(微課版)
- Building Microservices with .NET Core
- Emotional Intelligence for IT Professionals
- 算法設(shè)計(jì)與分析:基于C++編程語(yǔ)言的描述
- 可視化H5頁(yè)面設(shè)計(jì)與制作:Mugeda標(biāo)準(zhǔn)教程
- Splunk Developer's Guide(Second Edition)