DataGraph schema created by the EJB mediator
A “dummy” DataObject with the Eclass name of DataGraphRoot is also created and has containment reference to all the DataObjects. The reference is multivalued, using the EJB ASN name.
DataObject root = m.getGraph( parms ); root.getType().getName(); // this would return the string "DataGraphRoot" List depts = (List) root.get("DeptBean"); // the list of all DeptBean SDOs in the DataGraph List emps = (List) root.get("EmpBean"); // the list of all EmpBean SDOs in the DataGraph
DataGraph schema defined by the caller
The caller can create the DataGraph either using Eclipse Modeling Framework (EMF) APIs to programmatically create the schema dynamically, or by generating static Java classes from an EMF model. In either case the Eclass of the root DataObject must be passed to the mediator. If the DataGraph pattern includes a “dummy” root, then this root must be part of the user supplied schema and the Eclass of the root is passed on the create call.
A user created schema can contain additional attributes and references that are not set by the mediator when constructing DataObjects. However, if any attribute or reference required by the mediator query does not exist or has an inconsistent type, an exception occurs.
The Eclass names used in this schema are by default the EJB ASN names. You can override this by passing to the mediator a java.util.Map argument.
DataGraph containment patterns
References between Service Data Objects (SDO) can be defined as containment references, in which case when an SDO is deleted the delete is cascaded to all of the contained SDO. Also, when the DataGraph is serialized as an XML document, the contained SDO are nested within the parent SDO. Noncontained references are expressed as path expressions in the XML document.
Containment must be defined in the DataGraph schema. When the mediator defines the schema, the root SDO ( named DataGraphRoot) contains all other SDO. EJB relationships are defined as noncontained SDO references.