Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7549653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:00:00+00:00 2026-05-30T10:00:00+00:00

I just need some direction to get me going. So I am doing this

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:00:01+00:00Added an answer on May 30, 2026 at 10:00 am

    You can get the current time(stamp) as follows:

    long timestamp = System.currentTimeMillis();
    

    Or even as java.util.Date object:

    Date now = new Date();
    

    Then you have just to persist exactly that value as a TIMESTAMP field 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 @PreUpdate annotation for this.

    @Entity
    public class User {
    
        @Column @Temporal(TemporalType.TIMESTAMP)
        private Date lastUpdate;
    
        @PreUpdate
        public void onUpdate() {
            lastUpdate = new Date();
        }
    
    }
    

    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:

    lastUpdate TIMESTAMP DEFAULT now() ON UPDATE now() 
    

    That said, this all is unrelated to JSF/PrimeFaces.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just need get some vals located in application.ini(main ini) in the Controller plugin I
Maybe I am just over thinking this and need to write some more prototype
I just need some clarification on variables A normal variable has 2 parts to
I need some help with jQuery script again :-) Just trying to play with
Im just starting with localization today and need some information. I have a project
I'm just starting out with the whole ajax thing and I need some help.
Sometimes I need to find some strings inside DB usually it is just host-name
I need to serialize/de-serialize some objects into/from string and transfer them as just opaque
This question is messy, i dont need a working solution, i need some psuedo
I am just curious if someone can get me pointed in the right direction

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.