In these days for an Enterprise for its application is mandatory has a mechanism of persistence and easy way to access them, JPA 2.0 is an important option to be consider, important part of the whole package of JEE 6.
Thus this book let you learn from the scratch JPA 2.0, with an easy curve, already experimented programmers could consider this book like a good reference, below the TOC
Chapter 01: Introduction
Starting quickly about ORM, covered with valuable theory and even including some interesting opinions. Then many important topics like:
Each one covered with many alternatives available to accomplish each option , even including its respective explanation, really well done, therefore you know about how complex are these topics and how ORM resolve this
History for Java through its persitence support is covered, therefore JDBC, EJB, JDO are mentioned detailed, you know the pros and cons of each one. Therefore then EJB 3.0 and JPA 1.0 is introduced, later then JPA 2.0
Chapter 02: Getting Started
Starting quickly covering Entity Overview with concrete and valuable theory about important topics like: Persistability, Identity, Transactionality and Granularity. Then Entity Metadata is introduced and covering about XML and annotations.
With all this, a simple sample code working with a simple POJO and how it is transformed in an Entity is available. Then an important material is introduced, about the Entity Manager, even including an image showing all the JPA concepts, therefore you have a clear idea about how these components are related among them. Then the CRUD concept is applied to work with the Entity Manager, therefore, persisting, finding, removing and updating are covered, with a simple snippet code with its respective explanation. Even more Transactions and Queries are covered
With all this all these snippet code is shown together and Tested. Finally Persistence Unit is introduced to complete the sample code
Chapter 03: Enterprise Applications
Long chapter, mostly covered with a lot of theory and snippet code. Therefore important topics are covered like:
Chapter 04: Object-Relational Mapping
Other long chapter, well covered, valuable theory and even important images are included many times for a better understanding, of course, snippet source code with its repective explanation is available, the most important topics are
The associations is well covered, all the different options like One-To-Many and others, for each one an image is available for a better understanding
Chapter 05: Collection Mapping
A complement of the last section mentioned for the previous chapter. Starting covering about Relationships and Element Collections, bases with snippet source code and again images to get a better understanding. A section interesting is Using Different Collection Types covering Lists and Maps.
Other interesting sections are:
A final section for this chapter is about Best Practices
Chapter 06: Entity Manager
And impressive and long chapter. Like the most previous chapters, this one, is based again in a lot of theory, snippet source code and valuables images. Some of the most important sections available are
An important section is Synchronization with the Database, valuable theory available and important images included too. Therefore the follow two topics are covered deeply: Detachment and Merging
Chapter 07: Using Queries
Starting covering Java Persistence Query Language based on concrete theory and snippet source code, using the same approach to cover Filtering and Projecting Results, Joins Between Entities, Aggregate Queries and Query Parameters. Easy to follow and understand these topics
The follow section is Defining Queries covering Dynamic Query Definition and Named Query Definition with many snippet source code, easy to understand, same appreciation about Parameter Types. Some section valuable is about Working with Query Results, furthermore we have available an important approach used many times, Query Paging.
Other important section is Bulk Update and Delete based in more theory than source code. The last section of this chapter is about Query Best Practices, based in theory only
Chapter 08: Query Language
An important and key chapter for us. Starting quickly with an example data model, an image about this model is included, is not complex, but has its own difficulty since show many aspects, like association and hierarchy and others. Then a complete page about a tester class is included, interesting the code, but not very realistic.
Therefore with all this, a lot of sections are covered with concrete theory and snippet source code, like:
SELECT clause which cover
FROM clause which cover
WHERE clause which cover
Other sections important covered are:
Therefore the example data model is applied in action throughout these topics. An interesting chapter. Valuable like quick reference
Chapter 09: Criteria API
Other key chapter, well explained. Again a lot of sections are available like the previous chapter.
Starting with an introduction of the Criteria API itself, then covering Dynamic Queries, including two pages of code with its respective explanation.
With all this the section Building Criteria API Queries is introduced, an important image is available, called Criteria API Interfaces, practically all the elements are parameterized, a table called Criteria API Query Clause Methods is available too.
Other section well covered is Query Roots and Path Expressions, a lot of theory, snippet code and many tables available, well done this approach about include these tables, very useful like reference
Other sections are covered quickly with concrete theory and snippet code like
Chapter 10: Advanced Object-Relational Mapping
This is other really important and valuable chapter. It is long too. I going to share the most important sections. The chapter start with the section Advanced Object-Relational Mapping based on concrete theory and snippet code
The follow section is Complex Embedded Objects where an image called Nested embeddables with relationships is included, therefore next, some snippet code about some Entities of this image is shown, working with @Embeddable, @Embedded and @Access, even more, the author teaches us how, Overriding Embedded Relationships.
The next section is Compound Primary Keys working with the @IdClass and overriding the equals and hashCode methods. A variation of this, we have explanation about Embedded Id Class.
An important section is Derived Identifiers, long covering, explaining some sub sections like
Even including a table discussion called Alternative To Derived Identifiers
Even more, we have available the sections Advanced Mapping Elements which cover Read-Only Mappings and Optionality. The other section is Advanced Relationships covering many topics like:
Other important section covered is Multiple Tables, valuable snippet code and explanation, with important images for a better understanding. Then next comes an important and valuable topic for our consideration, it is Inheritance which cover:
Chapter 11: Advanced Topics
Another long chapter, starting explaining SQL Queries which includes many snippet code about Native Queries versus JDBC, even covering @NamedNativeQuery. Even more the follow topics are covered quickly with concrete theory and snippet code:
An interesting topic is about Lifecycle Callbacks, well covered, many pages with interesting theory with snippet code with its respective explanation is available. Other important and valuable section is about Validation working with JSR-303, good snippet code is available and even including a table about Built-in Validation Constraints showing each constraint and its respective explanation. A valuable section.
Other important section is about Concurrency and Locking, well done, valuable theory and snippet code included for the second, covering many topics like:
Short covering about source code about Pessimistic Locking but includes a good amount of theory.
Practically the last section of this chapter is about Caching, valuable theory, even including an important image about Layers of caching in JPA
Chapter 12: XML Mapping Files
A lot of snippet code and many sections available working with XML, see the TOC for a better idea. But be aware that practically this chapter show many features and options applied to work or be configured through XML.
Chapter 13: Packaging and Deployment
Shortest chapter compared with others, starting covering with the section Configuring Persistence Units, based more about theory than source code.
Other section is about Building and Deploying covering about classpaths and jars, here we have some options like EJB, Web Archive and Persistence Archive.
Schema Generation is covered, the follow topics are explained with concrete theory and source code:
Chapter 14: Testing
Starting with the section Testing Enterprise Applications, interesting theory and explaining some important terms like:
Then the section Unit Testing is covered, based with snippet code with this respective explanation, expansion of this topic is for example The Entity Manager in Unit Tests based on more snippet code.
After of this, covering for Integration Testing is available, again working with the Entity Manager.
A long section and important is about Transaction Management, good amount of theory and working with Container-Managed Transactions and Bean-Managed Transactions each one with this respective example about source code and respective explanation.
Chapter 15: Migration
Starting with an important section called Migrating from CMP Entity Beans, important steps instructions based on source code with its respective explanation is available, many pages used for all this.
Other important section is Leveraging Design Patterns, same approach explained like above is used again, some topics covered are:
A good amount of pages available
What I liked:
What I disliked:
The same and others reviews can be read it on my Blog here
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)