/** * This method will be used to set a new type of identity map for a particular class type. If * objects of that class type are in use loss of object identity will result. For prevention * client may wish to initialize all identity maps first. * * @param className the fully qualified className to set the identity map for. * @param identityMapClassType the fully qualified class name of the new identity map type. * @param maxSize the maximum size to be specified for the new identity map. * @exception ClassNotFoundException thrown then the IdenityMap for that class name could not be * found */ public void setIdentityMapForClass(String className, String identityMapClassType, int maxSize) throws ClassNotFoundException { Class classToChange = (Class) getSession() .getDatasourcePlatform() .getConversionManager() .convertObject(className, ClassConstants.CLASS); Class identityMapClass = null; if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) { try { identityMapClass = (Class) AccessController.doPrivileged(new PrivilegedClassForName(identityMapClassType)); } catch (PrivilegedActionException ex) { throw (RuntimeException) ex.getCause(); } } else { identityMapClass = PrivilegedAccessHelper.getClassForName(identityMapClassType); } ClassDescriptor descriptor = getSession().getDescriptor(classToChange); descriptor.setIdentityMapClass(identityMapClass); descriptor.setIdentityMapSize(maxSize); getSession().getIdentityMapAccessorInstance().initializeIdentityMap(classToChange); }