1 Reply Latest reply on May 5, 2010 1:58 PM by Leo van den berg

    How to update the value in database

    Anitha Raj Newbie
      Hello,

      I have a property named Last updated time in my entity.java file. I'm not showing this field in any of my xhtml files, but i want this value to be updated in the corresponding entity table of the database whenever a user adds an entity or updates an entity.

      To do this i have written the code which looks like this.

      protected Entity createInstance() {
                      Entity entity = new Entity();
                      entity.setLastUpdatedTime(new java.sql.Date(System.currentTimeMillis()));
                      return entity;
      }

      When i add a new entity the current time value will be added to the database, but when i update the existing entity the value is not getting updated.It retains its old value. What should i do inorder to do this? please help.