in transform/src/patch/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java [289:315]
private Object synchronizeMappings(final OpenJPAEntityManagerFactory factory) {
if (EntityManagerFactoryImpl.class.isInstance(factory)) {
final EntityManagerFactoryImpl entityManagerFactory = EntityManagerFactoryImpl.class.cast(factory);
final BrokerFactory brokerFactory = entityManagerFactory.getBrokerFactory();
if (!AbstractBrokerFactory.class.isInstance(brokerFactory)) {
throw new IllegalArgumentException("expected AbstractBrokerFactory but got " + brokerFactory);
}
try {
final Method synchronizeMappings = brokerFactory.getClass()
.getDeclaredMethod("synchronizeMappings", ClassLoader.class);
if (!synchronizeMappings.isAccessible()) {
synchronizeMappings.setAccessible(true);
}
return synchronizeMappings.invoke(brokerFactory, Thread.currentThread().getContextClassLoader());
} catch (final NoSuchMethodException | IllegalAccessException e) {
throw new IllegalStateException(e);
} catch (final InvocationTargetException e) {
final Throwable targetException = e.getTargetException();
if (RuntimeException.class.isInstance(targetException)) {
throw RuntimeException.class.cast(targetException);
}
throw new IllegalStateException(targetException);
}
} else {
throw new IllegalArgumentException("expected EntityManagerFactoryImpl but got " + factory);
}
}