Relation.Constraint.localKeyIsPrimary() now takes a DbMapping argument
since it is not granted that its own DbMapping reference is the actual home DbMapping (think mountpoints).
This commit is contained in:
parent
25255ad5da
commit
ab46b21529
1 changed files with 5 additions and 6 deletions
|
@ -701,7 +701,7 @@ public final class Relation {
|
||||||
: parent.getNonVirtualParent();
|
: parent.getNonVirtualParent();
|
||||||
String value = null;
|
String value = null;
|
||||||
|
|
||||||
if (constraints[i].localKeyIsPrimary()) {
|
if (constraints[i].localKeyIsPrimary(home.getDbMapping())) {
|
||||||
value = home.getID();
|
value = home.getID();
|
||||||
} else if (ownType.isRelational()) {
|
} else if (ownType.isRelational()) {
|
||||||
value = home.getString(constraints[i].localProperty());
|
value = home.getString(constraints[i].localProperty());
|
||||||
|
@ -724,7 +724,6 @@ public final class Relation {
|
||||||
*/
|
*/
|
||||||
public void setConstraints(Node parent, Node child) {
|
public void setConstraints(Node parent, Node child) {
|
||||||
Node home = parent.getNonVirtualParent();
|
Node home = parent.getNonVirtualParent();
|
||||||
|
|
||||||
for (int i = 0; i < constraints.length; i++) {
|
for (int i = 0; i < constraints.length; i++) {
|
||||||
// don't set groupby constraints since we don't know if the
|
// don't set groupby constraints since we don't know if the
|
||||||
// parent node is the base node or a group node
|
// parent node is the base node or a group node
|
||||||
|
@ -744,7 +743,7 @@ public final class Relation {
|
||||||
if (crel != null) {
|
if (crel != null) {
|
||||||
// INode home = constraints[i].isGroupby ? parent : nonVirtual;
|
// INode home = constraints[i].isGroupby ? parent : nonVirtual;
|
||||||
|
|
||||||
if (constraints[i].localKeyIsPrimary()) {
|
if (constraints[i].localKeyIsPrimary(home.getDbMapping())) {
|
||||||
// only set node if property in child object is defined as reference.
|
// only set node if property in child object is defined as reference.
|
||||||
if (crel.reftype == REFERENCE) {
|
if (crel.reftype == REFERENCE) {
|
||||||
INode currentValue = child.getNode(crel.propName);
|
INode currentValue = child.getNode(crel.propName);
|
||||||
|
@ -889,9 +888,9 @@ public final class Relation {
|
||||||
foreignName.equalsIgnoreCase(otherType.getIDField());
|
foreignName.equalsIgnoreCase(otherType.getIDField());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean localKeyIsPrimary() {
|
public boolean localKeyIsPrimary(DbMapping homeMapping) {
|
||||||
return (localName == null) ||
|
return (homeMapping == null) || (localName == null) ||
|
||||||
localName.equalsIgnoreCase(ownType.getIDField());
|
localName.equalsIgnoreCase(homeMapping.getIDField());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String foreignProperty() {
|
public String foreignProperty() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue