Eclipselink Understanding Eclipselink 2.4
Total Page:16
File Type:pdf, Size:1020Kb
EclipseLink Understanding EclipseLink 2.4 June 2013 EclipseLink Concepts Guide Copyright © 2012, 2013, by The Eclipse Foundation under the Eclipse Public License (EPL) http://www.eclipse.org/org/documents/epl-v10.php The initial contribution of this content was based on work copyrighted by Oracle and was submitted with permission. Print date: July 9, 2013 Contents Preface ............................................................................................................................................................... xiii Audience..................................................................................................................................................... xiii Related Documents ................................................................................................................................... xiii Conventions ............................................................................................................................................... xiii 1 Overview of EclipseLink 1.1 Understanding EclipseLink....................................................................................................... 1-1 1.1.1 What Is the Object-Persistence Impedance Mismatch?.................................................. 1-3 1.1.2 The EclipseLink Solution.................................................................................................... 1-3 1.2 Key Features ................................................................................................................................ 1-4 1.3 New Features............................................................................................................................... 1-4 1.3.1 RESTful Services .................................................................................................................. 1-4 1.3.2 Tenant Isolation.................................................................................................................... 1-5 1.3.3 NoSQL ................................................................................................................................... 1-5 1.3.4 JSON ...................................................................................................................................... 1-6 1.3.5 Database Change Notification ........................................................................................... 1-6 1.3.6 Extensible Entities................................................................................................................ 1-6 1.3.7 Composite Persistence Units.............................................................................................. 1-6 1.3.8 External Metadata Sources ................................................................................................. 1-7 1.4 Key Concepts............................................................................................................................... 1-7 1.4.1 EclipseLink Metadata.......................................................................................................... 1-7 1.4.2 Entities................................................................................................................................... 1-8 1.4.3 Descriptors............................................................................................................................ 1-8 1.4.4 Mappings .............................................................................................................................. 1-8 1.4.5 Data Access........................................................................................................................... 1-8 1.4.6 Caching.................................................................................................................................. 1-8 1.4.7 Queries .................................................................................................................................. 1-9 1.4.8 Expression Framework ....................................................................................................... 1-9 1.4.9 NoSQL Databases ................................................................................................................ 1-9 1.4.10 Performance Monitoring and Profiling ............................................................................ 1-9 1.5 Key Components......................................................................................................................... 1-9 1.5.1 EclipseLink Core and API .................................................................................................. 1-9 1.5.2 Object-Relational (JPA 2.0) Component ........................................................................ 1-10 1.5.3 Object-XML (JAXB 2.2) Component............................................................................... 1-10 1.5.3.1 SDO Component........................................................................................................ 1-11 iii 1.5.4 Database Web Services Component .............................................................................. 1-11 1.6 Key Tools................................................................................................................................... 1-12 1.6.1 Oracle JDeveloper ............................................................................................................ 1-12 1.6.2 Eclipse................................................................................................................................. 1-12 1.6.3 NetBeans ............................................................................................................................ 1-13 2 Understanding Mappings 2.1 About Object-Relational Mapping ........................................................................................... 2-1 2.1.1 Understanding Object-Relational Entity Architecture................................................... 2-1 2.1.1.1 Entities............................................................................................................................ 2-2 2.1.1.2 Persistence and Persistence Units .............................................................................. 2-2 2.1.1.3 Entity Managers............................................................................................................ 2-3 2.1.2 Adding Metadata Using Annotations .............................................................................. 2-3 2.1.2.1 Advantages and Disadvantages of Using Annotations.......................................... 2-4 2.1.3 About Configuration Basics ............................................................................................... 2-4 2.1.3.1 Default Configuration Values..................................................................................... 2-4 2.1.3.2 Configuring Persistence Units Using persistence.xml............................................ 2-4 2.1.3.3 Object-Relational Data Type Mappings .................................................................... 2-4 2.1.3.3.1 Specifying Object-Relational Mappings Using orm.xml ................................. 2-5 2.1.3.3.2 Specifying EclipseLink Object-Relational Mappings Using eclipselink-orm.xml 2-5 2.1.3.4 Overriding and Merging Mapping Information...................................................... 2-5 2.1.3.5 Validating the XML Schema ....................................................................................... 2-6 2.1.3.6 Advantages and Disadvantages of Using XML....................................................... 2-6 2.1.4 About Data Sources............................................................................................................. 2-6 2.1.5 About EclipseLink Caches.................................................................................................. 2-6 2.1.5.1 Defining Cache Behavior............................................................................................. 2-7 2.1.5.2 Caching in Clustered Environments.......................................................................... 2-7 2.1.6 About Database Queries..................................................................................................... 2-7 2.2 About Object-XML Mapping .................................................................................................... 2-8 2.2.1 Using EclipseLink Object-XML as the JAXB Provider ................................................... 2-8 2.2.2 Understanding Object-XML Architecture ....................................................................... 2-9 2.2.2.1 JAXB Contexts and JAXB Context Factories............................................................. 2-9 2.2.3 Serving Metadata for Object-XML ................................................................................. 2-10 2.2.4 About XML Bindings ....................................................................................................... 2-10 2.2.4.1 Specifying EclipseLink Object-XML Mappings Using eclipselink-oxm.xml ... 2-10 2.2.5 About Object-XML Data Type Mappings ..................................................................... 2-10 2.2.6 Querying Objects by XPath ............................................................................................. 2-11 3 Understanding Application Development 3.1 Typical Development Stages ..................................................................................................... 3-1