- 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
推薦閱讀
- PHP動態(tài)網(wǎng)站程序設(shè)計
- 大學(xué)計算機(jī)基礎(chǔ)實(shí)驗(yàn)教程
- WSO2 Developer’s Guide
- 數(shù)據(jù)結(jié)構(gòu)(C語言)
- SSM輕量級框架應(yīng)用實(shí)戰(zhàn)
- SQL Server 2012數(shù)據(jù)庫管理與開發(fā)項(xiàng)目教程
- 名師講壇:Spring實(shí)戰(zhàn)開發(fā)(Redis+SpringDataJPA+SpringMVC+SpringSecurity)
- INSTANT Adobe Edge Inspect Starter
- Mastering ArcGIS Enterprise Administration
- LabVIEW虛擬儀器程序設(shè)計從入門到精通(第二版)
- C語言程序設(shè)計簡明教程:Qt實(shí)戰(zhàn)
- 超簡單:Photoshop+JavaScript+Python智能修圖與圖像自動化處理
- Learning Unreal Engine Game Development
- 超好玩的Scratch 3.5少兒編程
- Python Linux系統(tǒng)管理與自動化運(yùn)維