JPA

What is JPA?

What does JPA do?

JPA Implementations

JPA Inheritance

JPA Inheritance - Table Per Concrete Class

JPA Inheritance - Single Table Per Class

JPA Inheritance - Joined Subclass

The JPA API

Annotations

@Entity

@Entity

@Id

Table(name = "TABLE_NAME")

Table(name = "TABLE_NAME")

@GeneratedValue(strategy = GenerationType.${ENUM_VALUE})

@GeneratedValue(strategy = GenerationType.TABLE)

@GeneratedValue(strategy = GenerationType.SEQUENCE)

@GeneratedValue(strategy = GenerationType.SEQUENCE)

@GeneratedValue(strategy = GenerationType.SEQUENCE)

@DiscriminatorColumn

@Column(name = "COLUMN_NAME")

@Column(name = "COLUMN_NAME")

@Temporal(TemporalType.ENUM_VALUE)

@Transient

@Enumerated(EnumType.HOW_TO_PERSIST)

Cardinal Relationships

Frequently Asked Questions (FAQs)

What is a discriminator column?

What is a cascading event?

What is fetching?

What is a Join Table?

What is a Database Catalog?

How is type-conversion handled between platforms?

What is Configuration by Exception?

What is an Entity?

What is MetaData?

What is an example of MetaDta?

@Entity
@Table(name = "people")
public class Person { ... }

What is an EntityManager ?

What is an EntityManager ?

Long id = 0;
Person person = em.find(Person.class, id);

What is an EntityManager ?

What is an EntityManager ?

What is an EntityManager ?

What is an EntityTransaction?

What is a Managed Entity?

What is a Query?

What is a Service Object?

What is CRUD?

What is Java Persistence Query Language (JPQL)?

What is Java Persistence Query Language (JPQL)?

How does JPQL translate to SQL?

SELECT		i
FROM		Item i
WHERE		i.unitCost > 100.00
ORDER BY	i.title;
SELECT		*
FROM		item
WHERE		unit_cost > 100.00
ORDER BY	title;

What is Persistence?

What is a Persistence Context?

What is a Persistence Unit?

How is a Persistent Unit expressed?