Add Author.java

This commit is contained in:
2026-07-25 05:36:17 +00:00
parent 48c6c068c6
commit 789e256407

View File

@@ -0,0 +1,32 @@
package com.ankurm.sdjpa4demo.domain;
import jakarta.persistence.*;
@Entity
public class Author {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
// Nullable on purpose: used to demonstrate NULLS FIRST/LAST precedence in Sort.
private String country;
protected Author() { }
public Author(String name, String country) {
this.name = name;
this.country = country;
}
public Long getId() { return id; }
public String getName() { return name; }
public String getCountry() { return country; }
@Override
public String toString() {
return "Author{id=" + id + ", name='" + name + "', country=" + country + "}";
}
}