3 Replies Latest reply on Apr 6, 2007 10:38 AM by fhh

    How to insert a timestamp to a Not Nullable column from a fo

    Alex Narinsky Newbie

      I have a class that contains a Date property - timestamp. Also, I have a form for persisting this object in the database. This form was created by the seam generator. In the database the timestamp is not nullable.

      The timestamp should be equal to a current time. A user should not insert it. So I removed this field from the form and changed the setter for this property

      public void setTimestamp(Date time) {
      if (time==null)
      timestamp = new Date();
      this.timestamp = time;

      However, the persisting mechanism does not use this setter. As a result I am getting the exception:
      Exception during request processing: javax.servlet.ServletException: #{projNotesHome.persist}: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: : com.scea.spot4.ProjNotes.timestamp

      Any suggestion?