How to wrap sublist with jaxb

后端 未结 3 946
孤独总比滥情好
孤独总比滥情好 2021-02-19 09:31

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

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-19 09:59

    It sounds like you want to wrap the Order in your CustomerJaxbDao class.

    @XmlElementWrapper( name="orders" )
    @XmlElement(name="order", type=OrderJaxbDao.class)
    public List getOrders() { return orders; };
    

    Might do what you want.

提交回复
热议问题