Do a isStrorageCompatible() rather than isRelational() to handle checks for
non-relational child nodes in isParentOf(). http://helma.org/bugs/show_bug.cgi?id=339#c17
This commit is contained in:
parent
5e13b2c99e
commit
b31871fdfb
1 changed files with 6 additions and 1 deletions
|
@ -1358,7 +1358,7 @@ public final class Node implements INode, Serializable {
|
||||||
* @return true if the given node is contained in this node's child list
|
* @return true if the given node is contained in this node's child list
|
||||||
*/
|
*/
|
||||||
public boolean isParentOf(Node n) {
|
public boolean isParentOf(Node n) {
|
||||||
if (dbmap != null && n.isRelational()) {
|
if (dbmap != null) {
|
||||||
Relation subrel = dbmap.getSubnodeRelation();
|
Relation subrel = dbmap.getSubnodeRelation();
|
||||||
// if we're dealing with relational child nodes use
|
// if we're dealing with relational child nodes use
|
||||||
// Relation.checkConstraints to avoid loading the child index.
|
// Relation.checkConstraints to avoid loading the child index.
|
||||||
|
@ -1368,6 +1368,11 @@ public final class Node implements INode, Serializable {
|
||||||
if (subrel != null && subrel.otherType != null
|
if (subrel != null && subrel.otherType != null
|
||||||
&& subrel.otherType.isRelational()
|
&& subrel.otherType.isRelational()
|
||||||
&& subrel.filter == null) {
|
&& subrel.filter == null) {
|
||||||
|
// first check if types are stored in same table
|
||||||
|
if (!subrel.otherType.isStorageCompatible(n.getDbMapping())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// if they are, check if constraints are met
|
||||||
return subrel.checkConstraints(this, n);
|
return subrel.checkConstraints(this, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue