making nodes transient that do have child nodes should now
work, because loadnodes no longer throws the existing nodes away to see if there are some in the database. dump stack traces on getKey and getID for transient nodes.
This commit is contained in:
parent
2b574f11fa
commit
55e58ab509
1 changed files with 32 additions and 23 deletions
|
@ -410,8 +410,10 @@ public final class Node implements INode, Serializable {
|
|||
*/
|
||||
|
||||
public String getID () {
|
||||
if (state == TRANSIENT)
|
||||
if (state == TRANSIENT) {
|
||||
Thread.dumpStack ();
|
||||
throw new RuntimeException ("getID called on transient Node: "+this);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -536,8 +538,10 @@ public final class Node implements INode, Serializable {
|
|||
}
|
||||
|
||||
public Key getKey () {
|
||||
if (state == TRANSIENT)
|
||||
if (state == TRANSIENT) {
|
||||
Thread.dumpStack ();
|
||||
throw new RuntimeException ("getKey called on transient Node: "+this);
|
||||
}
|
||||
if (dbmap == null && prototype != null && nmgr != null)
|
||||
dbmap = nmgr.getDbMapping (prototype);
|
||||
if (primaryKey == null)
|
||||
|
@ -1178,6 +1182,10 @@ public final class Node implements INode, Serializable {
|
|||
* ID index or the actual nodes.
|
||||
*/
|
||||
protected void loadNodes () {
|
||||
// Don't do this for transient nodes which don't have an explicit subnode relation set
|
||||
if ((state == TRANSIENT || state == NEW) && subnodeRelation == null)
|
||||
return;
|
||||
|
||||
DbMapping smap = dbmap == null ? null : dbmap.getSubnodeMapping ();
|
||||
if (smap != null && smap.isRelational ()) {
|
||||
// check if subnodes need to be reloaded
|
||||
|
@ -1647,9 +1655,9 @@ public final class Node implements INode, Serializable {
|
|||
prop.nhandle = new NodeHandle (new DbKey (n.getDbMapping (), kval, rel.getRemoteField ()));
|
||||
}
|
||||
|
||||
String nID = n.getID();
|
||||
|
||||
if (n.state != TRANSIENT) {
|
||||
// check node in with transactor cache
|
||||
String nID = n.getID();
|
||||
Transactor tx = (Transactor) Thread.currentThread ();
|
||||
tx.visitCleanNode (new DbKey (nmap, nID), n);
|
||||
// if the field is not the primary key of the property, also register it
|
||||
|
@ -1658,6 +1666,7 @@ public final class Node implements INode, Serializable {
|
|||
nmgr.evictKey (secKey);
|
||||
tx.visitCleanNode (secKey, n);
|
||||
}
|
||||
}
|
||||
|
||||
lastmodified = System.currentTimeMillis ();
|
||||
if (n.state == DELETED) n.markAs (MODIFIED);
|
||||
|
@ -1781,7 +1790,6 @@ public final class Node implements INode, Serializable {
|
|||
Transactor current = (Transactor) Thread.currentThread ();
|
||||
current.visitNode (this);
|
||||
current.visitCleanNode (this);
|
||||
}
|
||||
for (Enumeration e = getSubnodes (); e.hasMoreElements (); ) {
|
||||
Node n = (Node) e.nextElement ();
|
||||
if (n.state == TRANSIENT)
|
||||
|
@ -1796,6 +1804,7 @@ public final class Node implements INode, Serializable {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue