JPA Minibook

About the author

Hebert Coelho is a senior Java Developer, with 4 certifications and a published book about JSF (portuguese only).

He is the founder of the blog visited from more than 170 different countries.

One of the problems of Object Orientation is how to map the objects as the database requires. A common issue is when table and column names do not match with the domain model of our application.

The basic Java framework to access the database is JDBC. Unfortunately, with JDBC, a lot of hand work is needed to convert a database query result into Java classes. Other disadvantages of JDBC is its portability. The query syntax will change from one database to another. Furthermore application portability is a problematic issue when database native queries are used.

JPA was created as a solution to the problems mentioned earlier. JPA allows us to work with Java classes as it provides a transparent layer to each database specific details; JPA will do the hard work of mapping table to class structure and semantics for the developer. An easy definition to JPA is: “A group of specifications (a lot of texts, regularizations and Java Interfaces) to define how a JPA implementation should behave”.


JPA Minibook includes:

  1. What is JPA? What is a JPA Implementation?
  2. Entity definitions. What are the Logic and Physical annotations?
  3. Id Generation
  4. Simple and Complex Composite Key
  5. Mapping two or more tables in one entity
  6. Mapping Hierarchy
  7. Embedded Objects
  8. OneToOne unidirectional and bidirectional
  9. OneToMany/ManyToOne unidirectional and bidirectional
  10. ManyToMany unidirectional and bidirectional
  11. How the Cascade functionality works?
  12. Orphan Removal
  13. How to delete an entity with relationships
  14. Understanding how the Lazy/Eager option works
JCG eBooks are professionally designed, downloadable collections of popular JCG content – articles, interviews, presentations, and research – covering the latest software development technologies, trends, and topics.
Back to top button