I just need some direction to get me going. So I am doing this application, where a user is able to update his/her profile, and upon hitting the update button. The current time will be captured and be stored in the database.
I have never done anything like that before, and I would really appreciate it if someone can point me to an article or some documentation.
I am using primefaces, jsf, and mysql.
I have coded and get every function on my project working except for the update function. I would be happy to share my code here if anyone can help me out!
You can get the current time(stamp) as follows:
Or even as
java.util.Dateobject:Then you have just to persist exactly that value as a
TIMESTAMPfield in the DB. How exactly to do that isn’t answerable as you haven’t given any information about how you’re doing the persistence. If you’re using for example JPA, you could use the@PreUpdateannotation for this.Alternatively, depending on the DB used, you can also just configure the column to auto-update itself on every
UPDATE. In your case, you’re using MySQL, the MySQL create column syntax would be:That said, this all is unrelated to JSF/PrimeFaces.