I get a DanglingHREFException: e.g.,
"org.eclipse.emf.ecore.xmi.DanglingHREFException: The object
'com.example.Foo@2f5dda ()' is not contained in a resource." What do I
need to do?
All objects need to be contained by a resource in order to be
serialized. That implies that for EObject x to be serialized, it must
be the case that x.eResource() != null. The resource will be non-null
if either x is directly contained by a resource, i.e., if for Resource
r, r.getContents().contains(x), or if x has a container that in turn is
contained by a resource, i.e., if for Resource r,
r.getContents().contains(x.eContainer()). This definition is recursive.
So an object must be contained by a resource directly, or indirectly by
virtue of being part of a containment reference where, recursively, the
container too must be contained by a resource.
So if you get the above exception, that means you have some
object x contained by a resource r that refers to another object y,
that is not directly or indirectly contained by any resource. It's
possible to make the EReference feature used by x to refer to y be
transient, so that it's not saved at all, or to make it a containment
reference, so that y is contained by the same resource as x, but
barring changes to the Ecore model itself, the one and only way to
solve this problem is to add y to some resource, i.e.,
r.getContents().add(y), or to add/set it to some containment reference
of an object z, i.e., z.getYs().add(y), where z is already contained by
a resource, i.e., z.eResource() != null
转自:http://wiki.eclipse.org/index.php/EMF-FAQ#I_get_a_DanglingHREFException:_e.g..2C_.22org.eclipse.emf.ecore.xmi.DanglingHREFException:_The_object_.27com.example.Foo.402f5dda_.28.29.27_is_not_contained_in_a_resource..22_What_do_I_need_to_do.3F
分享到:
相关推荐
and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized ...
A filter is an object that performs filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both. Filters perform filtering in the ...
It is not a mail transfer protocol. Instead, it defines the content of what is transferred: the format of the messages, attachments, and so on. There are many different documents that take effect ...
All files are contained in a single installer file which includes the following: vsdrvr.h declaration file vsdrvr.lib library stub file vsdrvr.dll run-time library vsdrvr_r1p30.pdf (this file) ...
Allows to type (assign) values to Text property not contained in data list (Style = csDropDownEh). Allows to hold KeyValue and Text as not affecting to each other values. Take effect when Key...
This concise, self-contained guide covers most major language features and the major standard-library components—not, of course, in great depth, but to a level that gives programmers a meaningful ...
Allows to type (assign) values to Text property not contained in data list (Style = csDropDownEh). Allows to hold KeyValue and Text as not affecting to each other values. Take effect when Key...
A buffer object is also allowed as the source operand. BZ 480 Fixed a problem where the Load ASL operator allowed the source operand to be an operation region of any type. It is now restricted to ...
Defines the subset of the W3C Document Object Model (DOM) API that is not part of the Java SE API. jdk.zipfs Provides the implementation of the zip file system provider. JavaFX Module Description ...
The definition is not lim¬ited to de¬vices that use a physical tablet. In fact, this specification can support de¬vices that combine rela¬tive and absolute pointing as well as purely relative ...