Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
EclipseLink/FAQ/MOXy
Note: if the link to the User's Guide above does not work, click here.
What is EclipseLink MOXy?
MOXy is EclipseLink's Object-to-XML and Object-to-JSON Mapping services. MOXy allows for a POJO object model to be mapped to an XML schema. The Java Architecture for XML Binding (JAXB) provides a Java standard for object XML mapping (OXM). MOXy supports JAXB, as well as providing its' own native API and integration with Web Services.
Why should EclipseLink MOXy be used?
EclipseLink MOXy offers additional benefits versus usage of the JAXB 2.1 reference implementation and other similar solutions. The benefits include:
- Greater flexibility with meet-in-the-middle mapping
- Integrated support for usage with EclipseLink JPA
- Specific support for usage with SOA and SCA
- Transaction XML Storage
- Performance
This more flexible mapping approach is needed to handle mapping to multiple XSDs or XSD versions, sharing a common domain model with other technologies, and usage within other technologies such as SOA and SCA.
Meet in the Middle Mapping
In addition to the schema-to-Java and Java-to-schema approaches offered by the JAXB 2.1 reference implementation, EclipseLink MOXy offers meet in the middle mapping. Meet-in-the-middle mapping allows you to map your own classes to your own XML schema avoiding static coupling of your mapped classes with a single XML schema.
- The mapping is XPath based, this breaks the one-to-one correspondence between classes and XML elements in your schema.
- The mapping isolates the object model from changes in the XML schema and vice versa.
- There is an external XML document representation for the mapping metadata so that JAXB annotations are optional.
- The mapping is built on the same framework as EclipseLink's object-relational mapping and benefits from years of custom use and input as well as many customizable features.
JPA Compatibility
EclipseLink MOXy offers specific features to address mapping JPA entities to XML
- Mapping of compound keys.
- Mapping of relationship back-pointers and handling during marshaling and marshaling.
- Support usage of EclipseLink JPA specific enhancements for lazy loading and change tracking.
- Note: these enhancements are typically added to the JPA entities through dynamic of static weaving
EclipseLink JAXB in your SOA
EclipseLink JAXB was designed to turn your JPA applications into SOA components. Through the meet-in-the-middle mapping and JPA compatibility you can map your existing JPA models to industry standard schema. Not using JAX-WS? You can use our POJO/SDO bridge to expose your data as SDO (JSR-235, EclipseLink is the RI) Data Objects. The bridge leverages EclipseLink JAXB.
Transactional XML Storage
Interacting with a persistent data store based on XML? Since EclipseLink MOXy is built on the EclipseLink Foundation you can combine MOXy mappings and EclipseLink's persistence framework to interact with your data through JCA.
Performance
The EclipseLink MOXy implementation offers superior performance in several scenarios. Each release of EclipseLink continues to incorporate performance improvements with the goal of being superior is as many scenarios as possible while still offering the greater flexibility and integration described above.