Skip to content
Advertisement

How to get ‘now time’ from database using CrudRepository?

I have this example of entity:

JavaScript

and this example of repo:

JavaScript

But when I need to do:

JavaScript

I cant get creationDate anymore from:

JavaScript

Because some people are changing the time from OS, and the time of the creation are being persisted wrong. so I need some:

JavaScript

To set the creationDate from user.

Do I need a new repo to get the time, or I can use this UserRepository to get the creationDate from database?? I’ve tried create a UtilsRepository, where I might get the date from database:

JavaScript

But it isnt working. I’m getting this error, and I think that is not the best way to do that.

JavaScript

Advertisement

Answer

I solved this point doing that in the UserReposistory:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement