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每晚构建。