setting a node with null prototype will now set the prototype to the expected

value. If the prototype is already set to a different value, an exception is thrown.
This commit is contained in:
hns 2001-03-09 16:03:53 +00:00
parent eb05a99a29
commit 3f285ac8fd

View file

@ -1483,7 +1483,10 @@ public class Node implements INode, Serializable {
// check if types match, otherwise throw exception
DbMapping nmap = dbmap == null ? null : dbmap.getPropertyMapping (propname);
if (nmap != null && nmap != value.getDbMapping()) {
throw new RuntimeException ("Can't set "+propname+" to object with prototype "+value.getPrototype()+", was expecting "+nmap.getTypeName());
if (value.getDbMapping () == null)
value.setDbMapping (nmap);
else
throw new RuntimeException ("Can't set "+propname+" to object with prototype "+value.getPrototype()+", was expecting "+nmap.getTypeName());
}
checkWriteLock ();