* only use the parent-info from the type.properties file if there
is an explicit reference relation set for the property name. * avoid database queries for nodes that are transient or in the process of being persistified also when loadmode is set to aggressive.
This commit is contained in:
parent
ef756bdcc1
commit
3db1848822
1 changed files with 12 additions and 3 deletions
|
@ -634,9 +634,16 @@ public final class Node implements INode, Serializable {
|
||||||
if (parentInfo != null && state != TRANSIENT) {
|
if (parentInfo != null && state != TRANSIENT) {
|
||||||
for (int i=0; i<parentInfo.length; i++) {
|
for (int i=0; i<parentInfo.length; i++) {
|
||||||
ParentInfo pinfo = parentInfo[i];
|
ParentInfo pinfo = parentInfo[i];
|
||||||
INode pn = getNode (pinfo.propname, false);
|
INode pn = null;
|
||||||
|
// see if there is an explicit relation defined for this parent info
|
||||||
|
// we only try to fetch a node if an explicit relation is specified for the prop name
|
||||||
|
Relation rel = dbmap.propertyToRelation (pinfo.propname);
|
||||||
|
if (rel != null && rel.reftype == Relation.REFERENCE)
|
||||||
|
pn = getNode (pinfo.propname, false);
|
||||||
|
// the parent of this node is the app's root node...
|
||||||
if (pinfo.isroot && pn == null)
|
if (pinfo.isroot && pn == null)
|
||||||
pn = nmgr.getNode ("0", nmgr.getDbMapping ("root"));
|
pn = nmgr.getNode ("0", nmgr.getDbMapping ("root"));
|
||||||
|
// if we found a parent node, check if we ought to use a virtual or groupby node as parent
|
||||||
if (pn != null) {
|
if (pn != null) {
|
||||||
// see if dbmapping specifies anonymity for this node
|
// see if dbmapping specifies anonymity for this node
|
||||||
if (pinfo.virtualname != null)
|
if (pinfo.virtualname != null)
|
||||||
|
@ -645,7 +652,7 @@ public final class Node implements INode, Serializable {
|
||||||
try {
|
try {
|
||||||
if (dbm != null && dbm.getSubnodeGroupby () != null) {
|
if (dbm != null && dbm.getSubnodeGroupby () != null) {
|
||||||
// check for groupby
|
// check for groupby
|
||||||
Relation rel = (Relation) dbmap.getDB2Prop ().get (dbm.getSubnodeGroupby());
|
rel = (Relation) dbmap.getDB2Prop ().get (dbm.getSubnodeGroupby());
|
||||||
pn = pn.getSubnode (getString (rel.propName, false));
|
pn = pn.getSubnode (getString (rel.propName, false));
|
||||||
}
|
}
|
||||||
if (pn != null) {
|
if (pn != null) {
|
||||||
|
@ -1114,7 +1121,9 @@ public final class Node implements INode, Serializable {
|
||||||
if (smap != null && smap.isRelational ()) {
|
if (smap != null && smap.isRelational ()) {
|
||||||
// check if subnodes need to be rechecked
|
// check if subnodes need to be rechecked
|
||||||
Relation subRel = dbmap.getSubnodeRelation ();
|
Relation subRel = dbmap.getSubnodeRelation ();
|
||||||
if (subRel.aggressiveLoading) {
|
// do not fetch subnodes for nodes that haven't been persisted yet or are in
|
||||||
|
// the process of being persistified - except if "manual" subnoderelation is set.
|
||||||
|
if (subRel.aggressiveLoading && ((state != TRANSIENT && state != NEW) || subnodeRelation != null)) {
|
||||||
// we don't want to load *all* nodes if we just want to count them
|
// we don't want to load *all* nodes if we just want to count them
|
||||||
long lastChange = subRel.aggressiveCaching ? lastSubnodeChange : smap.getLastDataChange ();
|
long lastChange = subRel.aggressiveCaching ? lastSubnodeChange : smap.getLastDataChange ();
|
||||||
// also reload if the type mapping has changed.
|
// also reload if the type mapping has changed.
|
||||||
|
|
Loading…
Add table
Reference in a new issue