I'm learning to tinker with Javax, and Java persistence and want to know if there's any way to leave a default value for the database.
Example in SQL:
variacao TIMESTAMP DEFAULT CURRENT_TIMESTAMP
How would I do this in my Model code?
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id")
private int id;
@NotNull
@Column(name="nota")
private int nota;
@NotNull
@Column(name="data")
private Timestamp data;
@Column(name="comentario")
private String comentario;
@Column(name="evento_id")
private Evento evento_id;
@Column(name="pessoa_id")
private Pessoa pessoa_id;
1) What is the difference between the following items? a) @DefaultValues b) @PrePersistent c) @PreUpdate
2) And which one would I use for this case? a) @DefaultValues b) @PrePersistent c) @PreUpdate