Я пытаюсь использовать @CreationTimestamp
для переменной экземпляра типа Instant .
Я использую hibernate.version 5.2.10
и импортирую import org.hibernate.annotations.*;
, но все еще показываю Нет По умолчанию Предложения .
Вот мой код
import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import org.hibernate.annotations.*;
@MappedSuperclass
public class AbstractEntity {
@Id
@Column(nullable=false,updatable=false)
@GeneratedValue(strategy=GenerationType.IDENTITY)
protected Long id;
@CreationTimestamp
protected Instant created;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Instant getCreated() {
return created;
}