try
{
Object[] args = {factory};
setMethod.invoke(instance, args);
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (IllegalArgumentException e)
{
throw new RuntimeException("Failed in setting EntityManager on setter method: " + setMethod.toString());
}
catch (InvocationTargetException e)
{
throw new RuntimeException(e.getCause()); //To change body of catch statement use Options | File Templates.
}