Add Author.java
This commit is contained in:
32
src/main/java/com/ankurm/sdjpa4demo/domain/Author.java
Normal file
32
src/main/java/com/ankurm/sdjpa4demo/domain/Author.java
Normal 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 + "}";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user