When trying to map a customer-> order 1:n relationship with jaxb 2.2.6 I\'d like to get the list of orders wrapped in a separate node \"orders\".
currently the result is
Instead of
/**
* getter for orders
* @return orders
*/
@XmlElement(name="orders", type=OrderJaxbDao.class)
public List getOrders() { return orders; };
You need
/**
* getter for orders
* @return orders
*/
@XmlElement(name="order", type=OrderJaxbDao.class)
@XmlElementWrapper(name="orders")
public List getOrders() { return orders; };
The @XmlElementWrapper
name is the name of the wrapping element (orders) and the @XmlElement
name is the name of the per-entry element inside the wrapper (order).