fixed dbmapping check for untyped virtual nodes

This commit is contained in:
hns 2001-01-15 16:41:17 +00:00
parent 32283385d5
commit 69589a1928

View file

@ -230,8 +230,9 @@ public final class Property implements IProperty, Serializable, Cloneable {
if (rel != null && rel.other != null) { if (rel != null && rel.other != null) {
DbMapping vmap = value.getDbMapping (); DbMapping vmap = value.getDbMapping ();
// check if actual type matches expected type // check if actual type matches expected type
if (rel.other != vmap) if (rel.other != vmap && (!rel.virtual || rel.prototype != null)) {
throw new RuntimeException ("Can't assign property: expected prototype "+rel.other+", got "+vmap); throw new RuntimeException ("Can't assign property: expected prototype "+rel.other+", got "+vmap);
}
// check if this is a forward relation, i.e. if we point to a field in the value object // check if this is a forward relation, i.e. if we point to a field in the value object
// if so, we may use something else than the object's id to refer to it. // if so, we may use something else than the object's id to refer to it.
if (!rel.virtual && rel.direction == Relation.FORWARD) { if (!rel.virtual && rel.direction == Relation.FORWARD) {