The JPA / Hibernate timestamp is not saved in the database / object entity

I'm using javax Persistence as my entity object MySQL for database

@Column(name = "ENTRYDATE")   
private Date entryDate=new Date();

When I use the saveOrUpdate method to save an object, only the date is saved I also want to save time stamps and dates I have not set a specific date and have announced it together with the above on-site statement How can I get the time and save it with the date

thank you.

Solution

use

@Temporal(TemporalType.TIMESTAMP)

In your attributes

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>