-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Unable to Override Entity Graph in XML
PostPosted: Thu Jul 31, 2014 9:07 pm 
Newbie

Joined: Thu Jul 31, 2014 8:55 pm
Posts: 2
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.