1
鑑於下面的類:位置導致錯誤
@XmlSeeAlso({A.class, B.class})
@XmlDiscriminatorNode("@type")
public abstract class Base implements Serializable {
}
讓A
(和類似B
)是:
@XmlDiscriminatorValue("A")
public class A extends Base {
private String foo;
// constructor, getter, setter
}
包裝紙兩種類型的List<Base>
包含對象會導致對此示例JSON:
{
"list": [
{
"@type": "A",
"bar": 123
},
{
"@type": "A",
"bar": 789
},
{
"@type": "B",
"foo": "sddadad"
},
{
"@type": "B",
"foo": "ttf4eg4gf sd"
},
{
"@type": "A",
"bar": 465
}
]
}
現在爲止t其中我的問題踢:當@type
財產移出了「第一」的位置,解組失敗:
{
"bar" : 123,
"@type" : "A"
}
Exception Description: Missing class indicator field from database row [UnmarshalRecordImpl()].
這是一個預期的行爲?我是否必須確保@type
聲明始終是「第一」?
我正在使用EclipseLink 2.5.1.v20130619-ffd088c每晚構建。