Entity class – JPA

We need a domain model object to map the records inserted into our database. To do this, we will use the JPA specification; so, we will create an entity class for this purpose, as follows:

  1. Let's create a new Java package named model, in order to store the data model class. The fully qualified package name will be com.packtpub.thorntail.footballplayermicroservice.model.
  2. Next, we will build the domain class, named FootballPlayer:
package   com.packtpub.thorntail.footballplayermicroservice.model;   import java.math.BigInteger;   ...   /**    * Domain model class that maps the data stored into football_player table    * inside database.    *    * @author Mauro Vocale    * @version 1.0.0 15/08/2018    */   @Entity   @Table(name = "football_player") @XmlRootElement ...

Get Hands-On Cloud-Native Microservices with Jakarta EE now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.