I was following a tutorial and I created 2 entities, but when i run the application I get the following error "Invocation of init method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity: com.example.db_test.Post". It worked in the tutorial I was following, the tutorial is old so maybe this does not work anymore. What would be the correct way to create this 2 entities.
@Entity
public class Post {
    @Id
    @GeneratedValue
    private Long id;
    private String title;
    private String body;
    private Date postedOn;
    //Author
    @ManyToOne
    private Author author;
    private Post(){}
    public Post(String title){
        setTitle(title);
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getBody() {
        return body;
    }
    public void setBody(String body) {
        this.body = body;
    }
    public Date getPostedOn() {
        return postedOn;
    }
    public void setPostedOn(Date postedOn) {
        this.postedOn = postedOn;
    }
    public void setAuthor(Author author) {
        this.author = author;
    }
    public Author getAuthor() {
        return author;
    }
}
@Entity
public class Author {
    @Id
    @GeneratedValue
    private Long id;
    private String firstName;
    private String lastName;
    //posts
    @OneToMany(mappedBy = "author")
    private List<Post> posts;
    private Author(){
    }
    public Author(String firstName, String lastName){
        this.setFirstName(firstName);
        this.setLastName(lastName);
    }
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
    public String getFirstName() {
        return firstName;
    }
    public String getLastName() {
        return lastName;
    }
    public List<Post> getPosts() {
        return posts;
    }
    public void setPosts(List<Post> posts) {
        this.posts = posts;
    }
}
