Chapter 3
- ORM is a technique that allows you to fetch and manipulate data from a database using an object-oriented programming paradigm. JPA provides object-relational mapping for Java developers. Hibernate is a Java-based JPA implementation.
- The
entity
class is just a standard Java class that is annotated with the@Entity
annotation. You have to implement constructors, fields, getters and setters inside the class. The unique ID field(s) are annotated with the@Id
annotation. - You have to create a new interface that extends the Spring Data
CrudRepository
interface. You define the entity and the type of the id field in the type arguments—for example,<Car, Long>
. - The
CrudRepository
provides all CRUD operations to your entity. You can create, read, update, and delete your entities using theCrudRepository
. - You have to create entity classes and link the entities using the
@OneToMany
and@ManyToOne
annotations. - You can add demo data to your main application...