Titlu Pro JPA 2 Mastering the Java Persistence API (November 2009)
Autor Apress
Categorie Calculatoare / IT
Pro JPA 2 Mastering the Java Persistence API (November 2009)

We have attempted to show code examples whenever possible because it is usually easier to illustrate something through a code example than to spend two paragraphs explaining it. Of course, the paragraphs will still be there, but the code will hopefully make it clearer. The code examples tend not to be complete because we don’t want to clutter the demonstrative code up with extraneous implementation details. You will often see comments with ellipses in them, meaning we are leaving pieces out that we feel are unimportant to the issue. We have also tried to keep the examples as short as possible so as to conserve valuable page real estate. We used the Employee model in the first edition. Its simplicity and universality seemed to position it as the right model for beginners and advanced users alike. For this reason (and because we didn’t see any point in creating a whole new model just because the other one might have been a little dry) we have carried the Employee model over to this edition. We didn’t get any complaints about it in the first edition, so either it did its job, or it just put people to sleep and they were too dozy to complain. The state fields in the examples are all defined to have private access, even though this is not required by the specification. This was not a serious thing for us. It mostly resulted from the state fields in one or two examples having been made private, and the rest of the examples ending up getting changed for the sake of consistency. We have been very careful to ensure that the book is agnostic with respect to the standard code examples, but having said that, there are some cases when we required vendor-specific names or features to explain vendor-specific behavior. Naturally, we used the Reference Implementations (RI) of the Java EE 6 application server and the Java Persistence API. The Java EE 6 RI is called “Glassfish” and is a fully featured open sourced application server that can be used under the Common Development and Distribution License (CDDL). The RI for the Java Persistence API is called “EclipseLink”, and is an open source and freely available Eclipse project derived from the commercially successful Oracle TopLink product code base. Glassfish and EclipseLink can be downloaded together from java.net. The examples are available for download from the Apress web site at . We recommend downloading them and taking a look around to see how things work. Looking at and modifying examples is how you are going to figure out that JPA 2.0 has gone even further toward complete modeling.