我有两个使用共享库域的Java应用程序 manager 和服务器。 Hibernate映射是通过域源中的注释定义的。
我想要完成的是将服务器的缓存策略覆盖到某些性能测试的“只读”缓存策略。在the annotations documentation之后,我来到了我正在尝试的地步:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings
xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
version="2.0">
<entity class="com.example.data.Entity" metadata-complete="false">
<cache usage="read-only"/>
</entity>
...
</entity-mappings>
尝试镜像注释标记,将其与这些指令混合。问题是, entity 没有允许的元素 cache ,我得到:
Error parsing XML (line66 : column 108): cvc-complex-type.2.4.a: Invalid content was found starting with element 'cache'. One of '{"http://java.sun.com/xml/ns/persistence/orm":description, "http://java.sun.com/xml/ns/persistence/orm":table, "http://java.sun.com/xml/ns/persistence/orm":secondary-table, "http://java.sun.com/xml/ns/persistence/orm":primary-key-join-column, "http://java.sun.com/xml/ns/persistence/orm":id-class, "http://java.sun.com/xml/ns/persistence/orm":inheritance, "http://java.sun.com/xml/ns/persistence/orm":discriminator-value, "http://java.sun.com/xml/ns/persistence/orm":discriminator-column, "http://java.sun.com/xml/ns/persistence/orm":sequence-generator, "http://java.sun.com/xml/ns/persistence/orm":table-generator, "http://java.sun.com/xml/ns/persistence/orm":named-query, "http://java.sun.com/xml/ns/persistence/orm":named-native-query, "http://java.sun.com/xml/ns/persistence/orm":sql-result-set-mapping, "http://java.sun.com/xml/ns/persistence/orm":exclude-default-listeners, "http://java.sun.com/xml/ns/persistence/orm":exclude-superclass-listeners, "http://java.sun.com/xml/ns/persistence/orm":entity-listeners, "http://java.sun.com/xml/ns/persistence/orm":pre-persist, "http://java.sun.com/xml/ns/persistence/orm":post-persist, "http://java.sun.com/xml/ns/persistence/orm":pre-remove, "http://java.sun.com/xml/ns/persistence/orm":post-remove, "http://java.sun.com/xml/ns/persistence/orm":pre-update, "http://java.sun.com/xml/ns/persistence/orm":post-update, "http://java.sun.com/xml/ns/persistence/orm":post-load, "http://java.sun.com/xml/ns/persistence/orm":attribute-override, "http://java.sun.com/xml/ns/persistence/orm":association-override, "http://java.sun.com/xml/ns/persistence/orm":attributes}' is expected.
当我尝试返回 hibernate-core XML标记时,我得到&lt; class&gt; 定义不完整的错误,我似乎无法理解找到元数据完整模拟。有谁知道我想做什么是可能的?如果是这样,我将采取什么步骤?谢谢!