A little context - we have a RESTful service layer in front of our database, and we want to allow clients of that service to be able to pass a parameter that indicates the graph of data we get back. JPA 2.1 Named Entity Graphs, so far, has been great for helping optimize this.
We don't want to have to recompile our database beans every time we change one of these entity graphs, and the annotations get really ugly looking once you have more than one relatively complex graph defined. So I went to use orm.xml and got this error:
named-attribute-node.value is mandatory in XML overriding. Activate schema validation for more information
For reference, my testing xml looks like this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence/orm
http://xmlns.jcp.org/xml/ns/persistence/orm_2_1.xsd" version="2.1">
<entity name="TestEntity" class="service.test.TestEntity">
<named-entity-graph name="TestEntity.withChild">
<named-attribute-node name="withChild" />
</named-entity-graph>
</entity>
</entity-mappings>
If I change name="withChild" to value="withChild", as the error suggests, I instead get:
org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'value' is not allowed to appear in element 'named-attribute-node'.
Which contradicts the first error.
Am I missing something here? Thanks in advance for the help.
EDIT: Using Hibernate 4.3.6.Final, for what it's worth