开发者

JAXB Annotations and SuperClass

开发者 https://www.devze.com 2023-04-08 16:27 出处:网络
I\'m trying to use JAXB annotations in a parent class so that all the sub classes can inherit them but I\'m running into a marshaling error.I don\'t get the below error when I include @XmlRootElement

I'm trying to use JAXB annotations in a parent class so that all the sub classes can inherit them but I'm running into a marshaling error. I don't get the below error when I include @XmlRootElement and @XmlAccessorType(XmlAccessType.FIELD) in the sub class

error: HTTP Status 500 - Could not find MessageBodyWriter for response object of type: java.util.ArrayList of media type: application/xml

@MappedSuperclass
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
开发者_如何学Pythonpublic class Parent {

//class contents here
}

public class Child extends Parent{

//class contents here
}


You have to list all of your subclasses in @XmlSeeAlso annotation of your parent class.

0

精彩评论

暂无评论...
验证码 换一张
取 消