Marshaling a long primitive type using JAXB

前端 未结 4 1895
小鲜肉
小鲜肉 2021-01-18 10:08

To marshal a long primitive type using JAXB, I have used @XmlJavaTypeAdapter annotation, which will adapt non-String type to a String. Even though it throw erro

4条回答
  •  悲哀的现实
    2021-01-18 10:53

    Just replace

     @XmlElement(type=Long.class)
    private long id;
    

    with

        @XmlSchemaType(name = "long")
    protected Long id;
    

提交回复
热议问题