- 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
推薦閱讀
- MySQL數據庫管理實戰
- Raspberry Pi for Python Programmers Cookbook(Second Edition)
- 自己動手寫搜索引擎
- 觸·心:DT時代的大數據精準營銷
- ThinkPHP 5實戰
- Linux C/C++服務器開發實踐
- Arduino開發實戰指南:LabVIEW卷
- Learn Scala Programming
- 嚴密系統設計:方法、趨勢與挑戰
- INSTANT Yii 1.1 Application Development Starter
- Python機器學習開發實戰
- Professional JavaScript
- Spring Boot從入門到實戰
- 像程序員一樣使用MySQL
- R統計應用開發實戰