- Let's start with adding the javax.persistence package dependency to the Maven configuration file pom.xml:
<dependency> <groupId>javax.persistence</groupId> <artifactId>javax.persistence-api</artifactId> <version>2.2</version></dependency>
We don't need any of the JPA implementations yet. This way, we can make sure that our code does not use any framework-specific code and uses only JPA interfaces.
- Create the class Person1:
public class Person1 { private int age; private String name; public Person1(int age, String name){ this.age = age; this.name = name; } @Override public String toString() { return "Person1{id=" + id + ", age=" + age + ", name='" + name + "'}"; }}
We don't add getters, setters, or any other methods; ...