July 24, 2013

EclipseLink MOXy and the Java API for JSON Processing - Object Model APIs

The Java API for JSON Processing (JSR-353) is the Java standard for producing and consuming JSON which was introduced as part of Java EE 7.  JSR-353 includes object (DOM like) and stream (StAX like) APIs.  In this post I will demonstrate the initial JSR-353 support we have added to MOXy's JSON binding in EclipseLink 2.6.  You can now use MOXy to marshal to:
  • javax.json.JsonArrayBuilder
  • javax.json.JsonObjectBuilder
 And unmarshal from:
  • javax.json.JsonStructure
  • javax.json.JsonObject
  • javax.json.JsonArray

You can try this out today using a nightly build of EclipseLink 2.6.0:

The JSR-353 reference implementation is available here:

July 12, 2013

Oracle WebLogic 12.1.2 Now With EclipseLink MOXy JSON-Binding

Oracle WebLogic 12.1.2 is now available.  WebLogic 12.1.2 contains EclipseLink 2.4.2, this means that for the first time EclipseLink MOXy's JSON-binding is available in WebLogic out of the box.  I will demonstrate the benefits of using MOXy for JSON-binding with an example.

June 21, 2013

Mapping Bad XML - Enumerated Collection Elements

In a previous post I introduced EclipseLink JAXB (MOXy)'s @XmlVariableNode extension.  In this post I'll demonstrate how @XmlVariableNode could be leveraged to handle an interesting question I came across on Stack Overflow.  In that question instead of a collection being represented with an element that appeared multiple times, the element name contained the index.  While I would never recommend structuring your XML document this way sometimes you encounter it and need to be able to map it.

June 19, 2013

MOXy's @XmlVariableNode - Using a Map's Key as the Node Name

People often ask me how they can map a java.util.Map such that the keys become the node names.  In this post I will demonstrate how this can be done using the new Variable Node mapping that we have added in EclipseLink MOXy.

You can try this out today using a nightly build of EclipseLink 2.6.0:

June 17, 2013

MOXy's @XmlVariableNode - JSON Schema Example

We are in the process of adding the ability to generate a JSON Schema from your domain model to EclipseLink MOXy.  To accomplish this we have created a new Variable Node mapping. In this post I will demonstrate the new mapping by mapping a Java model to a JSON Schema.

You can try this out today using a nightly build of EclipseLink 2.6.0:

June 12, 2013

MOXy is the New Default JSON-Binding Provider in GlassFish 4

GlassFish 4 is now available offering the complete Java EE 7 (JSR-342) platform.  EclipseLink made some major contributions to this release.  The first is providing the JPA 2.1 (JSR-338) implementation.  The second which I'll cover in this post is EclipseLink MOXy is now the default JSON-binding provider for JAX-RS applications.

May 28, 2013

EclipseLink 2.5 Release Available for Download

On behalf of the MOXy JAXB committers (great job by all), I am very proud to announce that EclipseLink 2.5 has been released and is available for download.  In this post I will summarize what is new in the MOXy component.  For details on the entire release see the following link:

How to Get EclipseLink 2.5

You can download the EclipseLink install from:
EclipseLink 2.5 is also available from Maven Central (see http://wiki.eclipse.org/EclipseLink/Maven):
<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>org.eclipse.persistence.moxy</artifactId>
    <version>2.5.0</version>
 </dependency>

April 12, 2013

Customizing EclipseLink JPA-RS Messages with MOXy

In a previous post I covered how EclipseLink JPA-RS can be used to expose a JPA persistence unit as a RESTful service.  In that example we interacted with the default message formats.  Since JPA-RS leverages MOXy for its XML and JSON binding we can use MOXy to customize the messages.  In this post I will demonstrate how this is done.

Introducing EclipseLink JPA-RS

In a previous series of posts I covered how to create a JAX-RS service that leveraged JPA for the persistence layer.  EclipseLink contains a component called JPA-RS that can be used to easily and automatically expose a persistence unit as RESTful service (that supports XML and JSON messages).  MOXy provides the XML and JSON-binding for JPA-RS and things like bidirectional mappings are automatically mapped for you.  In another post I cover how MOXy can be used to customize the messages shown in this example.

I will use the JPA model that I created in the posts below:

April 10, 2013

MOXy's Object Graphs - Handling Inheritance

In previous posts we have explored how object graphs can be defined through metadata and programatically.  In this post I'll demonstrate the impact of inheritance in your domain model on how you define object graphs.

You can try this out today by downloading an EclipseLink 2.5.0 nightly download starting on March 24, 2013 from: