code: public void prePersist() {
          this.createdAt = getCurrentTime();
  
          if (this.createdBy == null || this.createdBy.trim().length()<1) {
              this.createdBy = getUserName();
          }
      }
docs: Called by JPA container before sql insert.