/** * INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based * settings. This method is used when converting a project that has been built with class names to * a project with classes. */ @Override public void convertClassNamesToClasses(ClassLoader classLoader) { super.convertClassNamesToClasses(classLoader); Iterator iterator = getTypeIndicatorNameTranslation().entrySet().iterator(); this.typeIndicatorTranslation = new HashMap(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); String referenceClassName = (String) entry.getKey(); Object indicator = entry.getValue(); Class referenceClass = null; try { if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { try { referenceClass = (Class) AccessController.doPrivileged( new PrivilegedClassForName(referenceClassName, true, classLoader)); } catch (PrivilegedActionException exception) { throw ValidationException.classNotFoundWhileConvertingClassNames( referenceClassName, exception.getException()); } } else { referenceClass = PrivilegedAccessHelper.getClassForName(referenceClassName, true, classLoader); } } catch (ClassNotFoundException exception) { throw ValidationException.classNotFoundWhileConvertingClassNames( referenceClassName, exception); } addClassIndicator(referenceClass, indicator); } }
/** * INTERNAL: The foreign key names and their primary keys are converted to DatabaseField and * stored. */ protected void initializeForeignKeys(AbstractSession session) { HashMap newSourceToTargetQueryKeyNames = new HashMap(getSourceToTargetQueryKeyNames().size()); Iterator iterator = getSourceToTargetQueryKeyNames().entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); DatabaseField field = getDescriptor().buildField((DatabaseField) entry.getKey()); newSourceToTargetQueryKeyNames.put(field, entry.getValue()); } this.sourceToTargetQueryKeyNames = newSourceToTargetQueryKeyNames; }