Home » Author Archives: Blaise Doughan (page 2)

Author Archives: Blaise Doughan

Team lead for the TopLink/EclipseLink JAXB & SDO implementations, and the Oracle representative on those specifications.

JAXB – Representing Null and Empty Collections

java-interview-questions-answers

Demo Code The following demo code will be used for all the different versions of the Java model. It simply sets one collection to null, the second to an empty list, and the third to a populated list.             package package blog.xmlelementwrapper; import java.util.ArrayList; import javax.xml.bind.*; public class Demo { public static void main(String[] args) ...

Read More »

Applying a Namespace During JAXB Unmarshal

java-logo

For some an XML schema is a strict set of rules for how the XML document must be structured. But for others it is a general guideline to indicate what the XML should look like. This means that sometimes people want to accept input that doesn’t conform to the XML schema for some reason. In this example I will demonstrate ...

Read More »

JAXB and Root Elements

java-interview-questions-answers

@XmlRootElement is an annotation that people are used to using with JAXB (JSR-222). It’s purpose is to uniquely associate a root element with a class. Since JAXB classes map to complex types, it is possible for a class to correspond to multiple root elements. In this case @XmlRootElement can not be used and people start getting a bit confused. In ...

Read More »

JAXB – No Annotations Required

java-interview-questions-answers

There appears to be a misconception that annotations are required on the model in order to use a JAXB (JSR-222) implementation. The truth is that JAXB is configuration by exception, so annotations are only required when you want to override default behaviour. In this example I’ll demonstrate how to use JAXB without providing any metadata. Domain Model I will use ...

Read More »

GlassFish 3.1.2 is Full of MOXy (EclipseLink JAXB)

oracle-glassfish-logo

I am very happy to announce that EclipseLink JAXB (MOXy) is now a JAXB ( JSR-222) provider in GlassFish 3.1.2. I would like to thank the EclipseLink and GlassFish committers for all their hard work to make this happen. In this post I will introduce how MOXy can be leveraged to create a JAX-WS service. In future posts I will ...

Read More »

MOXy as Your JAX-RS JSON Provider – Client Side

json-logo

Recently I posted how to leverage EclipseLink JAXB (MOXy)‘s JSON binding to create a RESTful service.  In this post I will demonstrate how easy it is to take advantage of MOXy’s JSON binding on the client side. MOXy as Your JAX-RS JSON Provider – Server Side MOXy as Your JAX-RS JSON Provider – Client Side URI This post will focus ...

Read More »

MOXy as Your JAX-RS JSON Provider – Server Side

json-logo

In a previous series of posts I covered how EclipseLink JAXB (MOXy) can be leveraged to create a RESTful data access service. In this post I will cover how easy it is to leverage MOXy’s new JSON binding on the server side to add support for JSON messages based on JAXB mappings. MOXy as Your JAX-RS JSON Provider – Server ...

Read More »

JAXB and Unmapped Properties

java-interview-questions-answers

JAXB (JSR-222) is configuration by exception, meaning that there is a default mapping applied to domain objects. This means that sometimes you need to explicitly exclude a field/property. In this post I’ll discuss how this can be done using @XmlTransient or @XmlAccessorType(XmlAccessType.NONE) and when each option is appropriate. @XmlTransient When you mark a field/property with @XmlTransient you are explicitly telling ...

Read More »

Reusing Generated JAXB Classes

java-logo

In this post I will demonstrate how to leverage the -episode XJC extension to reuse classes previously generated from.an XML schema. This is useful when an XML schema is imported by other XML schemas and you do not want the same classes generated each time. Imported Schema (Product.xsd) The following XML schema represents basic information about a product. Product is ...

Read More »

Mapping Objects to Multiple XML Schemas – Weather Example

eclipselink-logo

I have written previous posts on EclipseLink JAXB (MOXy)‘s @XmlPath and external binding file extensions. In this post I will demonstrate how powerful these extensions are by mapping a single object model to two different XML schemas. To make the example more “real”, the XML data will come from two different services that provide weather information: Google and Yahoo. Java ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close