I try to save the date of creation of my entity. I have found that approach. I tried to implement it but the date doesn't reach my db-table.
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.PrePersist;
@Entity
public class Project implements Serializable {
 private static final long serialVersionUID = 7620757776698607619L;
 @Id
 int id;
 String title;
 Date created;
 public int getId() {
  return id;
 }
 public void setId(int id) {
  this.id = id;
 }
 public void setTitle(String title) {
  this.title = title;
 }
 public String getTitle() {
  return title;
 }
 @PrePersist
 protected void onCreate() {
   created = new Date();
 }
 public Date getCreated() {
  return created;
 }
}
Only title is being saved. The field for data is empty :-(
Where is my mistake? Thank you for helping me.
Update
I tried to add the annotation of pascal but it didn't help. Is it possible that I should use sql.date istead of utils.date. I try this but I can't find how to get today's date...
 
     
    