if (emfWrapperClass.isAssignableFrom(entityManagerFactory.getClass())) {
try {
EntityManagerFactory emf = (EntityManagerFactory) emfGetDelegateMethod.invoke(entityManagerFactory);
return emf;
} catch (InvocationTargetException e) {
throw new JpaGpsDeviceException("Failed to invoke getDelegate method on [" + entityManagerFactory + "]", e.getTargetException());
} catch (Exception e) {
throw new JpaGpsDeviceException("Failed to invoke getDelegate method on [" + entityManagerFactory + "]", e);
}
}
return entityManagerFactory;
}