delegate = new EntityManagerFactoryDelegate(newSetupImpl, deployProperties, this);
// This code has been added to allow validation to occur without actually calling createEntityManager
// RCM refresh command requires the DEPLOY_ON_STARTUP property is set to true so the listener can be added to the session.
try{
if (newSetupImpl.shouldGetSessionOnCreateFactory(deployProperties)) {
ServerSession session = getServerSession();
CommandManager rcm = session.getCommandManager();
if (rcm != null && newSetupImpl.shouldSendMetadataRefreshCommand(deployProperties)) {
MetadataRefreshCommand command = new MetadataRefreshCommand(properties);
rcm.propagateCommand(command);
}
session.setRefreshMetadataListener(newSetupImpl);
}
} catch (RuntimeException ex) {
if(delegate != null) {
delegate.close();
} else {