Kodo™ 4.2.0.load03 Developers Guide for JPA/JDO Copyright © 1996, 2008 Oracle and/or its affiliates. All rights reserved. Kodo™ 4.2.0.load03 Developers Guide for JPA/JDO Copyright © 1996, 2008 Oracle and/or its affiliates. All rights reserved. Table of Contents 1. Introduction ............................................................................................................................................. 1 1. Kodo JPA/JDO ................................................................................................................................. 3 1.1. OpenJPA .............................................................................................................................. 3 1.2. About This Document ............................................................................................................. 3 2. Java Persistence API ................................................................................................................................. 4 1. Introduction ..................................................................................................................................... 9 1.1. Intended Audience .................................................................................................................. 9 1.2. Lightweight Persistence ........................................................................................................... 9 2. Why JPA? ......................................................................................................................................10 3. EJB Persistence Architecture .............................................................................................................12 3.1. EJB Exceptions .....................................................................................................................13 4. Entity ............................................................................................................................................15 4.1. Restrictions on Persistent Classes .............................................................................................16 4.1.1. Default or No-Arg Constructor ......................................................................................16 4.1.2. Final ........................................................................................................................16 4.1.3. Identity Fields ............................................................................................................16 4.1.4. Version Field .............................................................................................................16 4.1.5. Inheritance ................................................................................................................17 4.1.6. Persistent Fields .........................................................................................................17 4.1.7. Conclusions ...............................................................................................................18 4.2. Entity Identity ......................................................................................................................18 4.2.1. Identity Class .............................................................................................................19 4.2.1.1. Identity Hierarchies ..........................................................................................20 4.3. Lifecycle Callbacks ...............................................................................................................21 4.3.1. Callback Methods .......................................................................................................21 4.3.2. Using Callback Methods ..............................................................................................22 4.3.3. Using Entity Listeners .................................................................................................23 4.3.4. Entity Listeners Hierarchy ............................................................................................23 4.4. Conclusions .........................................................................................................................24 5. Metadata ........................................................................................................................................25 5.1. Class Metadata .....................................................................................................................26 5.1.1. Entity .......................................................................................................................26 5.1.2. Id Class .....................................................................................................................27 5.1.3. Mapped Superclass .....................................................................................................27 5.1.4. Embeddable ...............................................................................................................27 5.1.5. EntityListeners ...........................................................................................................28 5.1.6. Example ...................................................................................................................28 5.2. Field and Property Metadata ....................................................................................................30 5.2.1. Transient ...................................................................................................................31 5.2.2. Id .............................................................................................................................31 5.2.3. Generated Value .........................................................................................................31 5.2.4. Embedded Id .............................................................................................................32 5.2.5. Version .....................................................................................................................32 5.2.6. Basic ........................................................................................................................32 5.2.6.1. Fetch Type ......................................................................................................33 5.2.7. Embedded .................................................................................................................33 5.2.8. Many-To-One ............................................................................................................33 5.2.8.1. Cascade Type ..................................................................................................34 5.2.9. One-To-Many ............................................................................................................35 5.2.9.1. Bidirectional Relations ......................................................................................36 5.2.10. One-To-One .............................................................................................................36 5.2.11. Many-To-Many ........................................................................................................37 5.2.12. Order By .................................................................................................................37 iv Kodo™ 4.2.0.load03 Developers Guide for JPA/JDO 5.2.13. Map Key .................................................................................................................38 5.2.14. Persistent Field Defaults .............................................................................................38 5.3. XML Schema .......................................................................................................................38 5.4. Conclusion ...........................................................................................................................55 6. Persistence .....................................................................................................................................60 6.1. persistence.xml .....................................................................................................................60 6.2. Non-EE Use .........................................................................................................................62 7. EntityManagerFactory ......................................................................................................................63 7.1. Obtaining an EntityManagerFactory ..........................................................................................63 7.2. Obtaining EntityManagers ......................................................................................................63 7.3. Persistence Context ...............................................................................................................64 7.3.1. Transaction Persistence Context ....................................................................................64 7.3.2. Extended Persistence Context ........................................................................................65 7.4. Closing the EntityManagerFactory ............................................................................................66 8. EntityManager ................................................................................................................................67 8.1. Transaction Association
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages748 Page
-
File Size-