Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/MOXy"

Line 26: Line 26:
 
=== Working with JSON (NEW in 2.4) ===
 
=== Working with JSON (NEW in 2.4) ===
 
*[[EclipseLink/Examples/MOXy/JSON_Twitter|Twitter Example]]
 
*[[EclipseLink/Examples/MOXy/JSON_Twitter|Twitter Example]]
*:Using MOXy to process JSON returned from a Twitter query
+
*:Use MOXy to process JSON returned from a Twitter query.
 
*[[EclipseLink/Examples/MOXy/JSON_Geocode|Google Maps Geocode Example]]
 
*[[EclipseLink/Examples/MOXy/JSON_Geocode|Google Maps Geocode Example]]
*:Using MOXy to process JSON returned from a Google Maps query
+
*:Use MOXy to process JSON returned from a Google Maps query.
 
*[[EclipseLink/Examples/MOXy/MOXy_JSON_Provider|MOXy JSON Provider]]
 
*[[EclipseLink/Examples/MOXy/MOXy_JSON_Provider|MOXy JSON Provider]]
*:Using MOXyJsonProvider to make JAX-RS integration even easier
+
*:Use MOXyJsonProvider to make JAX-RS integration even easier.
 
*[[EclipseLink/Examples/MOXy/JSON_Metadata|JSON Metadata]]
 
*[[EclipseLink/Examples/MOXy/JSON_Metadata|JSON Metadata]]
*:Writing MOXy bindings files in JSON
+
*:Write MOXy bindings files in JSON.
  
 
=== Working with JPA ===
 
=== Working with JPA ===
 
JPA provides an easy and powerful means to use Java objects to interact with a relational database. These Java objects are called entities, and have their own characteristics. Some of these characteristics (bidirectional relationships, compound keys, embedded key classes, and lazy loading) can cause challenges when mapping these objects to XML. Learn how to easily map JPA entities to XML using MOXy.  
 
JPA provides an easy and powerful means to use Java objects to interact with a relational database. These Java objects are called entities, and have their own characteristics. Some of these characteristics (bidirectional relationships, compound keys, embedded key classes, and lazy loading) can cause challenges when mapping these objects to XML. Learn how to easily map JPA entities to XML using MOXy.  
 
*[[EclipseLink/Examples/MOXy/JPA/Relationships|JPA Relationships]]
 
*[[EclipseLink/Examples/MOXy/JPA/Relationships|JPA Relationships]]
*:Learn how to bind JPA Relationships to XML
+
*:Learn how to bind JPA Relationships to XML.
 
*[[EclipseLink/Examples/MOXy/JPA/CompoundPrimaryKeys|Compound Primary Keys]]
 
*[[EclipseLink/Examples/MOXy/JPA/CompoundPrimaryKeys|Compound Primary Keys]]
*:Learn how to bind Compound Primay Keys to XML
+
*:Learn how to bind Compound Primay Keys to XML.
 
*[[EclipseLink/Examples/MOXy/JPA/EmbeddedIdClass|Embedded ID Classes]]
 
*[[EclipseLink/Examples/MOXy/JPA/EmbeddedIdClass|Embedded ID Classes]]
*:Learn how to bind Embedded ID Classes to XML
+
*:Learn how to bind Embedded ID Classes to XML.
  
 
=== Integration ===
 
=== Integration ===
Line 49: Line 49:
 
=== Mapping with XPath ===
 
=== Mapping with XPath ===
 
*[[EclipseLink/Examples/MOXy/XPath|XPath]]
 
*[[EclipseLink/Examples/MOXy/XPath|XPath]]
*:XPath based mapping.
+
*:Map objects to XML using XPath.
 
*[[EclipseLink/Examples/MOXy/ElementMappingByAttributeValue|XPath Mapping with Predicates]]  
 
*[[EclipseLink/Examples/MOXy/ElementMappingByAttributeValue|XPath Mapping with Predicates]]  
*:Mapping elements based on the value of an attribute.
+
*:Map elements based on the value of an attribute.
  
 
=== Extensible Models ===
 
=== Extensible Models ===
 
*[[EclipseLink/Examples/MOXy/MetadataRepository|MOXY Metadata Repository]]  
 
*[[EclipseLink/Examples/MOXy/MetadataRepository|MOXY Metadata Repository]]  
*:Store mappings using a MetadataSource external to the running application so that mapping overrides and extended mappings can be more dynamically integrated into deployed applications  
+
*:Store mappings using a MetadataSource external to the running application so that mapping overrides and extended mappings can be more dynamically integrated into deployed applications
 
*[[EclipseLink/Examples/MOXy/MultipleBindingsFiles|Multiple Bindings Files]]  
 
*[[EclipseLink/Examples/MOXy/MultipleBindingsFiles|Multiple Bindings Files]]  
*:Process multiple bindings files from different locations, and create a merged set of metadata. This allows a JAXBContext to be created to represent any version of the XML document
+
*:Process multiple bindings files from different locations, and create a merged set of metadata. This allows a JAXBContext to be created to represent any version of the XML document.
 
*[[EclipseLink/Examples/MOXy/Extensible|XML Extensions]]  
 
*[[EclipseLink/Examples/MOXy/Extensible|XML Extensions]]  
*:Make MOXy JAXB beans extensible so that at runtime a set of additional extended mappings can be used
+
*:Make MOXy JAXB beans extensible so that a set of additional extended mappings can be used at runtime.
 
*[[EclipseLink/Examples/MOXy/RefreshMetadata|RefreshMetadata]]  
 
*[[EclipseLink/Examples/MOXy/RefreshMetadata|RefreshMetadata]]  
 
*:Update the metadata (in this example to include information about new extensions) without stopping the application.
 
*:Update the metadata (in this example to include information about new extensions) without stopping the application.
Line 67: Line 67:
  
 
*[[EclipseLink/Examples/MOXy/Dynamic/StaticComparison|Static Comparison]]
 
*[[EclipseLink/Examples/MOXy/Dynamic/StaticComparison|Static Comparison]]
*:See how Dynamic JAXB compares with static JAXB
+
*:See how Dynamic JAXB compares with static JAXB.
 
*[[EclipseLink/Examples/MOXy/Dynamic/JAXBContextFromXMLSchema|JAXBContext from XML Schema]]
 
*[[EclipseLink/Examples/MOXy/Dynamic/JAXBContextFromXMLSchema|JAXBContext from XML Schema]]
*:See how to bootstrap a Dynamic JAXBContext from an XML Schema
+
*:See how to bootstrap a Dynamic JAXBContext from an XML Schema.
 
*[[EclipseLink/Examples/MOXy/Dynamic/XmlToDynamicEntity|XML to DynamicEntity]]
 
*[[EclipseLink/Examples/MOXy/Dynamic/XmlToDynamicEntity|XML to DynamicEntity]]
*:Learn how to unmarshal an XML document to DynamicEntities
+
*:Learn how to unmarshal an XML document to DynamicEntities.
 
*[[EclipseLink/Examples/MOXy/Dynamic/DynamicEntityToXml|DynamicEntity to XML]]
 
*[[EclipseLink/Examples/MOXy/Dynamic/DynamicEntityToXml|DynamicEntity to XML]]
*:Learn how to marshal DyanamicEntities to XML
+
*:Learn how to marshal DyanamicEntities to XML.
  
 
=== Working with SDO ===
 
=== Working with SDO ===
Line 81: Line 81:
 
== Using Native OXM through JAXB Examples ==
 
== Using Native OXM through JAXB Examples ==
 
* [[EclipseLink/Examples/MOXy/NativeOxmJaxbContext | Creating a Native OXM aware JAXBContext]]
 
* [[EclipseLink/Examples/MOXy/NativeOxmJaxbContext | Creating a Native OXM aware JAXBContext]]
*:Use the EclipseLink Workbench to map Java classes to an XML Schema, and Marshal and Unmarshal XML documents using JAXB APIs
+
*:Use the EclipseLink Workbench to map Java classes to an XML Schema, and Marshal and Unmarshal XML documents using JAXB APIs.

Revision as of 14:09, 18 June 2012

The following examples are provided to assist developers with their adoption and usage of EclipseLink's JAXB and native OXM functionality.

EclipseLink provides a standards-based JAXB implementation with many extensions. For an introduction to the JAXB 2.0 reference implementation please see the following page:


EclipseLink MOXy Examples

General

  • Getting Started
    No metadata is required to convert your existing object model to XML. Supply metadata (using annotations or XML) only when you need to fine tune the XML representation. Get started using MOXy.
  • Using EclipseLink MOXy's JAXB
    Java Architecture for XML Binding (JSR 222) is the standard for XML Binding in Java. JAXB covers 100% of XML Schema concepts. Learn how to use MOXy as your JAXB provider.
  • Meet in the Middle Mapping Advantages
    Compare meet-in-the-middle mapping to other approaches. Normally in XML Binding solutions there is a one-to-one correspondence between the object model and the levels of nesting in the resulting XML document. Learn how to leverage MOXy's XPath-based mapping to remove these limitations.
  • Using EclipseLink MOXy's XML Mapping (eclipselink-oxm.xml)
    Externalizing the JAXB and extended mappings in an eclipselink-oxm.xml mapping file can separate the XML bindings from the domain classes.
  • XMLNameTransformer
    Customized XML Name Conversions.

Working with JSON (NEW in 2.4)

Working with JPA

JPA provides an easy and powerful means to use Java objects to interact with a relational database. These Java objects are called entities, and have their own characteristics. Some of these characteristics (bidirectional relationships, compound keys, embedded key classes, and lazy loading) can cause challenges when mapping these objects to XML. Learn how to easily map JPA entities to XML using MOXy.

Integration

Mapping with XPath

Extensible Models

  • MOXY Metadata Repository
    Store mappings using a MetadataSource external to the running application so that mapping overrides and extended mappings can be more dynamically integrated into deployed applications
  • Multiple Bindings Files
    Process multiple bindings files from different locations, and create a merged set of metadata. This allows a JAXBContext to be created to represent any version of the XML document.
  • XML Extensions
    Make MOXy JAXB beans extensible so that a set of additional extended mappings can be used at runtime.
  • RefreshMetadata
    Update the metadata (in this example to include information about new extensions) without stopping the application.

Dynamic JAXB

Traditional JAXB maps static classes (POJOs) to XML. Dynamic JAXB uses objects (instances of DynamicEntity) with generic get/set methods instead avoiding the need for the class generation step entirely.

Working with SDO

Using Native OXM through JAXB Examples