diff --git a/src/main/java/com/ankurm/sdjpa4demo/domain/Author.java b/src/main/java/com/ankurm/sdjpa4demo/domain/Author.java new file mode 100644 index 0000000..5fe180f --- /dev/null +++ b/src/main/java/com/ankurm/sdjpa4demo/domain/Author.java @@ -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 + "}"; + } +}