Traditionally, JPA ‘Entity’ classes are specified in a persistence.xml file. With Spring Boot this file is not necessary and instead ‘Entity Scanning’ is used
@Entity public class Hotel implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long id; @ManyToOne(optional = false) @NaturalId private City city; @Column(nullable = false) @NaturalId private String name; @Column(nullable = false) private String address; @Column(nullable = false) private String zip; @OneToMany(fetch = FetchType.LAZY, mappedBy = "hotel") private Set<Review> reviews; protected Hotel() { } public Hotel(City city, String name) { this.city = city; this.name = name; } public City getCity() { return this.city; } public String getName() { return this.name; } public String getAddress() { return this.address; } public String getZip() { return this.zip; } } how create spring boot entity by tool? i don't want to write entity manual .
@Getterand@Setter(and more features) from project Lombok projectlombok.org/features/GetterSetter.html