Persisting data with Jakarta Persistence
Jakarta Persistence is used to persist data to an RDBMS. Jakarta Persistence Entities are regular Java classes; the Jakarta EE runtime knows these classes are Entities because they are decorated with the @Entity annotation. Let’s look at a Jakarta Persistence Entity mapping to the CUSTOMER table in the CUSTOMERDB database:
package com.ensode.jakartaeebook.persistenceintro.entity
//imports omitted for brevity
@Entity
@Table(name = "CUSTOMERS")
public class Customer implements Serializable {
  @Id
  @Column(name = "CUSTOMER_ID")
  private Long customerId;
  @Column(name = "FIRST_NAME")
  private String firstName;
  @Column(name = "LAST_NAME")
  private String lastName;
  private String email;
  //getters and setters omitted for brevity
} In our example code, the @Entity annotation lets any other Jakarta...