hel*_*ldt 2 orm jpa one-to-one
我在尝试映射JPA中的一对一关系时得到org.xml.sax.SAXParseException
一切都很好,直到我改变
<transient name="testCase"/>
至:
<attributes>
..
<one-to-one name="testCase">
<join-column name="test_case_id"/>
</one-to-one>
..
</attributes>
Run Code Online (Sandbox Code Playgroud)
给出错误:
引起:org.xml.sax.SAXParseException:cvc-complex-type.2.4.a:找到以元素"一对一"开头的无效内容.其中一个'{"http://java.sun.com/xml/ns/persistence/orm":many-to-many,,http://java.sun.com/xml/ns/persistence/orm":嵌入式,"http://java.sun.com/xml/ns/persistence/orm":transient}"是预期的.
我不明白异常消息的含义.为什么会出现这种情况?
根据它的XML Schema,您的orm.xml无效.问题是元素"一对一"是序列的一部分,这意味着包含的元素必须遵守定义的顺序.
架构的摘要:
<xsd:complexType name="attributes">
<xsd:sequence>
...
<xsd:element name="basic" .../>
<xsd:element name="version" .../>
<xsd:element name="many-to-one" .../>
<xsd:element name="one-to-many" .../>
<xsd:element name="one-to-one" .../>
<xsd:element name="many-to-many" .../>
...
</xsd:sequence>
</xsd:complexType>
Run Code Online (Sandbox Code Playgroud)
在这里输入链接描述,查看整个Schema
| 归档时间: |
|
| 查看次数: |
1020 次 |
| 最近记录: |