【发布时间】:2016-09-09 06:27:32
【问题描述】:
当我在课堂上有地图时
private Map<Range<BigDecimal>, BigDecimal> ranges;
我使用以下 XML 映射文件:
<?xml version="1.0"?>
<xml-bindings
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
package-name="package-name">
<xml-schema element-form-default="QUALIFIED">
<xml-ns prefix="prefix" namespace-uri="namespace-uri"/>
</xml-schema>
<java-types>
<java-type name="MyJavaType" xml-accessor-type="FIELD">
<java-attributes>
<xml-transient java-attribute="ranges"/>
</java-attributes>
</java-type>
</java-types>
</xml-bindings>
为什么 xml-transient 不起作用?
它失败了:
The class com.google.common.collect.Range requires a zero argument constructor or a specified factory method.
Note that non-static inner classes do not have zero argument constructors and are not supported.
如果我使用列表,它可以工作。
【问题讨论】:
标签: jaxb eclipselink moxy jaxb2