throw new ConstraintException("Reference "+refDef.getName()+" in class "+refDef.getOwner().getName()+" does not reference any class");
}
}
// now checking the type
ClassDescriptorDef ownerClassDef = (ClassDescriptorDef)refDef.getOwner();
ModelDef model = (ModelDef)ownerClassDef.getOwner();
String targetClassName = refDef.getProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF);
ClassDescriptorDef targetClassDef = model.getClass(targetClassName);
if (targetClassDef == null)
{
throw new ConstraintException("The class "+targetClassName+" referenced by "+refDef.getName()+" in class "+ownerClassDef.getName()+" is unknown or not persistent");
}
if (!targetClassDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_OJB_PERSISTENT, false))
{
throw new ConstraintException("The class "+targetClassName+" referenced by "+refDef.getName()+" in class "+ownerClassDef.getName()+" is not persistent");
}
if (CHECKLEVEL_STRICT.equals(checkLevel))
{
try
{
InheritanceHelper helper = new InheritanceHelper();
if (refDef.isAnonymous())
{
// anonymous reference: class must be a baseclass of the owner class
if (!helper.isSameOrSubTypeOf(ownerClassDef, targetClassDef.getName(), true))
{
throw new ConstraintException("The class "+targetClassName+" referenced by the anonymous reference "+refDef.getName()+" in class "+ownerClassDef.getName()+" is not a basetype of the class");
}
}
else