if(ref==null){
throw new RulesException("undefined","session.createEntity","An attempt ws made to create the entity "+name.stringValue()+"\n" +
"This entity isn't defined in the EDD");
}
if(!ref.isReadOnly()){
REntity e = (REntity) ref.clone(this);
entityInstances.put(id,e);
return e;
}
return ref;
}