Basic knowledge:
In Java, the types that represent time and date include: java. util. date and java. util. calendar. in addition, three java extensions are provided in the jdbc api. util. subclass of the Date class: java. SQL. date, java. SQL. time and java. SQL. timestamp, which corresponds to the DATE, TIME, and TIMESTAMP types in the standard SQL type respectively.
In standard SQL, the DATE type indicates the DATE, the TIME type indicates the TIME, and the TIMESTAMP type indicates the TIME stamp. It also contains the DATE and TIME information.
How to map? 1. because java. util. date is java. SQL. date, java. SQL. time and java. SQL. timestamp parent class, so java. util. date can correspond to DATE, TIME, and TIMESTAMP2. of the standard SQL type based on 1, so it is set to java when setting the Date type of persistence class. util. date, because this type can correspond to three Date types in hibernate. how to Set java. util. date is mapped to DATE, TIME, and TIMESTAMP?
Can I use prZ labels? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> frequency =" date "type =" time ">
Use Hibernate built-in ing type
The Hibernate ing type must be explicitly specified in the following cases
A Java type may correspond to multiple Hibernate ing types. for example, if the persistence class property is java. util. date type. The corresponding Hibernate ing type can be date, time, or timestamp. in this case, the Hibernate ing type must be determined based on the SQL type of the corresponding data table field. if the field is of the DATE type, the Hibernate ing type is date. If the field is of the TIME type, the Hibernate ing type is time. If the field is of the TIMESTATMP type, the Hibernate ing type is timestamp.