Generate a time in Java with a date and a month, and save the Hibernate object to the Date field in Oracle.
The first method:
The CreateDate property of the Java entity class, type Java.util.Date
Hibernate mapping file <property name= "CreateDate" >
<column name= "Create_date"/>
</property>
Command.setcreatedate (New Timestamp () (New Date (). GetTime ())); So you can set it in.
The attribute type in the entity class is java.util.Date, the mapping file type= "Date", this cannot be written, it can only be saved to date
The second method:
The CreateDate property of the Java entity class, type Java.sql.Timestamp
Hibernate mapping file <property name= "CreateDate" type= "Timestamp" >
<column name= "Create_date"/>
</property>
Command.setcreatedate (New Timestamp () (New Date (). GetTime ())); So you can set it in.
Hibernate Save Oracle Date Time