Problem when saving date in mysql database with spring

Asked

Viewed 166 times

0

I am trying to save a date in the database using spring + jpa in mysql. In my class I have the following field:

@Column(name = "dataNasc") 
@DateTimeFormat(pattern = "yyyy-MM-dd")
@NotNull
private Date dataNasc;

When I try to save for example: 2020-02-11, it saves with the time together. What can I do to remove the time?

  • 1

    the date is deprecated, if you are saving without the hours, exchange for a Localdate

  • worked! thanks! Want to comment out the question so I give the vote for your answer?

  • 1

    I sent, just give that like rs..

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.