'@CreationTimestamp is not available with Instant Variable
I am trying to use @CreationTimestamp for an instance variable of Instant type.
I am using hibernate.version 5.2.10 and imported import org.hibernate.annotations.*;
but still showing No Default Proposals.
Here is my code
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;
}
Solution 1:[1]
You can try to add @EntityListeners(AuditingEntityListener.class) annotation on the class.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Adhonores |
