I am working on a spring boot application (v2.1.5.RELEASE) with h2 as an in-memory database. I created a simple project with a main and only one model Person.java with just 3 private fields. I have no constructor at all but when I launch the application and open the h2 console, I am still able to see the table created from the entity Person. I read from a SO question that a no-args constructor is needed when we use @entity annotation. Is it mandatory?
Person.java
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Person {
@Id
private String name;
private double age;
private String dateOfBirth;
}
main class
@SpringBootApplication
public class CommandLineApp {
public static void main(String[] args) {
SpringApplication.run(CommandLineApp.class);
}
}
