1

我有一个问题,我无法弄清楚如何使用 bindings.xjc 文件中的条目来自定义 ComplexType 内容的列长度。

复杂类型定义为:

  <xsd:element name="Comment">
    <xsd:complexType>
      <xsd:simpleContent>
        <xsd:extension base="xsd:string">
          <xsd:attribute name="MyAttr" type="MyAttrSchemaType"/>
        </xsd:extension>
      </xsd:simpleContent>
    </xsd:complexType>
  </xsd:element>

bindings.xjc 文件条目是:

  <jaxb:bindings node="xsd:element[@name='Comment']/xsd:complexType">
    <hj:basic name="value">
      <orm:column length="1024"/>
    </hj:basic>
  </jaxb:bindings>

生成的 Java 代码是:

  public class Comment implements Serializable, Equals, HashCode {

    @XmlValue
    protected String value;
    ...

    @Basic
    @Column(name = "VALUE_", length = 255)
    public String getValue() {
      return value;
    }

    ...
  }

问题是,当我运行 Maven 构建时,此自定义被忽略,但其他自定义已成功应用。

以下警告出现在构建输出中,我相信第一个是相关的:

[警告] 类 [...评论] 中未确认的自定义 [{ http://hyperjaxb3.jvnet.org/ejb/schemas/customizations }basic]。

[警告] 剧集文件 [.../target/generated-sources/xjc/META-INF/sun-jaxb.episode] 不可写,无法添加 if-exists 属性。

我花了很多时间寻找答案并阅读可用的文档,但到目前为止还一片空白,因此非常感谢任何帮助。

4

0 回答 0