Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/MOXy"

Line 24: Line 24:
*:Customized XML Name Conversions.
*:Customized XML Name Conversions.
=== Working with JSON (NEW in EclipseLink 2.4) ===
=== Working with JSON (NEW in EclipseLink) ===
*[[EclipseLink/Examples/MOXy/JSON_Twitter|Twitter Example]]
*[[EclipseLink/Examples/MOXy/JSON_Twitter|Twitter Example]]
*:Using MOXy to process JSON returned from a Twitter query
*:Using MOXy to process JSON returned from a Twitter query

Revision as of 14:49, 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


  • 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. Map an existing object model to an existing XML schema. This can commonly occur when you have an existing application that you wish to expose as a web service using an XML schema corresponding to some industry standard.
  • 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 EclipseLink)

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.


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 at runtime a set of additional extended mappings can be used
  • RefreshMetadata
    Update the metadata (in this example to include information about new extensions) without stopping the application.

Dynamic JAXB

  • 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