
"Once you've mapped a class to a database table and established its primary key, you have everything you need to create, retrieve, delete, and update that class in the database. Calling entityManager.save() will create or update the specified class, depending on whether the primary-key field is null or applies to an existing entity. Calling entityManager.remove() will delete the specified class."
"JPA also lets you manage entities in relation to one another. Four kinds of entity relationships are possible in both tables and objects: Each type of relationship describes how an entity relates to other entities. For example, the Musician entity could have a one-to-many relationship with Performance, an entity represented by a collection such as List or Set. If the Musician included a Band field, the relationship between these entities could be many-to-one, implying a collection of Musicians on the single Band class."
Mapping a class to a database table and establishing a primary key enables create, retrieve, update, and delete operations via EntityManager. Calling entityManager.save() will create or update an entity depending on whether its primary-key field is null or matches an existing entity; calling entityManager.remove() deletes the entity. JPA supports four relationship types—one-to-many, many-to-one, many-to-many, and one-to-one—between entities and corresponding tables. Relationships can use collections like List or Set for one-to-many, single-valued fields for many-to-one, self-referencing collections for many-to-many, and single associated entities for one-to-one. Relationship mappings use annotations such as @JoinColumn to specify foreign keys.
Read at InfoWorld
Unable to calculate read time
Collection
[
|
...
]