Also check for multi-constraint relations when adding child nodes and defer setting of constraints until nodes are persisted. Fixes a bug reported by Simon Oberhammer on the mailing list: http://groups.google.com/group/helma/browse_frm/thread/8026700caf582560
This commit is contained in:
parent
3c44bb305d
commit
9c123b41e9
1 changed files with 8 additions and 3 deletions
|
@ -841,8 +841,9 @@ public final class Node implements INode, Serializable {
|
|||
node.checkWriteLock();
|
||||
}
|
||||
|
||||
Relation subrel = dbmap == null ? null : dbmap.getSubnodeRelation();
|
||||
// if subnodes are defined via relation, make sure its constraints are enforced.
|
||||
if ((dbmap != null) && (dbmap.getSubnodeRelation() != null)) {
|
||||
if (subrel != null && subrel.countConstraints() < 2) {
|
||||
dbmap.getSubnodeRelation().setConstraints(this, node);
|
||||
}
|
||||
|
||||
|
@ -853,7 +854,7 @@ public final class Node implements INode, Serializable {
|
|||
|
||||
// only mark this node as modified if subnodes are not in relational db
|
||||
// pointing to this node.
|
||||
if (!ignoreSubnodeChange() && ((state == CLEAN) || (state == DELETED))) {
|
||||
if (!ignoreSubnodeChange() && (state == CLEAN || state == DELETED)) {
|
||||
markAs(MODIFIED);
|
||||
}
|
||||
|
||||
|
@ -874,7 +875,7 @@ public final class Node implements INode, Serializable {
|
|||
|
||||
NodeHandle nhandle = node.getHandle();
|
||||
|
||||
if ((subnodes != null) && subnodes.contains(nhandle)) {
|
||||
if (subnodes != null && subnodes.contains(nhandle)) {
|
||||
// Node is already subnode of this - just move to new position
|
||||
synchronized (subnodes) {
|
||||
subnodes.remove(nhandle);
|
||||
|
@ -2493,11 +2494,15 @@ public final class Node implements INode, Serializable {
|
|||
* so that the Transactor knows they are to be persistified.
|
||||
*/
|
||||
private void makeChildrenPersistable() {
|
||||
Relation subrel = dbmap == null ? null : dbmap.getSubnodeRelation();
|
||||
for (Enumeration e = getSubnodes(); e.hasMoreElements();) {
|
||||
Node n = (Node) e.nextElement();
|
||||
|
||||
if (n.state == TRANSIENT) {
|
||||
n.makePersistable();
|
||||
if (subrel != null && subrel.countConstraints() > 1) {
|
||||
subrel.setConstraints(this, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue