[英]hyperjaxb3 xsd:string length in JPA entity
我使用Hyperjaxb3從XSD架構生成JPA實體。 我有一個xsd:string類型,我想用於描述文本(UI中的文本區域):
<xsd:complexType name="Description">
<xsd:simpleContent>
<xsd:extension base="**xsd:string**">
<xsd:attribute name="abc" type="xsd:NCName" use="optional" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
Hyperjaxb3生成帶有屬性值的類(實體)描述,其注釋如下:
@Basic
@Column(name = "VALUE_", **length = 255**)
public String getValue() {
return value;
}
我的問題是:
我看到如果對xsd:simpleType設置xsd:maxLength限制,則JPA @ Column.length的值為maxLength。 如何在xsd:string的xsd:extension的xsd:simpleContent上設置xsd:recriction? 我必須使用xsd:resctriction定義一個complexType,然后將其擴展嗎? 如果是的話,Hyperjaxb將根據我的限制生成@ Column.length。 我嘗試了以下操作:
<xsd:simpleType name="DescriptionParent">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="4096" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="Description">
<xsd:simpleContent>
<xsd:extension base="DescriptionParent">
<xsd:attribute name="abc" type="xsd:NCName" use="optional" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
但是,JPA列長度仍為255。
是否還可以在我的JAXB定制(* .xjb文件)中設置給定類型的列的長度(以某種方式讓hyperjaxb知道這是我要用於特定類型的orm)? 還是完全不對,應該使用xsd:maxLength(在上方)我設法為Hyperjaxb定制全局設置了它:
謝謝你的幫助。
第二個問題:是的,您可以為簡單類型配置全局類型映射。
請參閱單個屬性的按類型自定義 。
第一個問題:這似乎是錯誤/缺失功能,請在此處提交問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.