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 uaiHebert.com 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”.
Entity definitions. What are the Logic and Physical annotations?
Id Generation
Simple and Complex Composite Key
Mapping two or more tables in one entity
Mapping Hierarchy
Embedded Objects
OneToOne unidirectional and bidirectional
OneToMany/ManyToOne unidirectional and bidirectional
ManyToMany unidirectional and bidirectional
How the Cascade functionality works?
Orphan Removal
How to delete an entity with relationships
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.