class Hibernate3JPAHelper {

    /** The logger. */
    private static AgentLogger LOGGER = AgentLogger.getLogger(Hibernate3JPAHelper.class);

    /** The wrapped persistence unit names. */
    // each persistence unit should be wrapped only once
    static Set<String> wrappedPersistenceUnitNames = new HashSet<>();

    /**
     * Creates the container entity manager factory proxy.
     *
     * @param info            persistent unit definition
     * @param properties            properties to create entity manager factory
     * @param original            entity manager factory
     * @return proxy of entity manager
     */
    public static EntityManagerFactory createContainerEntityManagerFactoryProxy(PersistenceUnitInfo info,
            Map<?,?> properties, EntityManagerFactory original) {
        // ensure only once
        if (wrappedPersistenceUnitNames.contains(info.getPersistenceUnitName())){
            return original;
        }
        wrappedPersistenceUnitNames.add(info.getPersistenceUnitName());

        EntityManagerFactoryProxy wrapper = EntityManagerFactoryProxy.getWrapper(info.getPersistenceUnitName());
        EntityManagerFactory proxy = wrapper.proxy(original, info.getPersistenceUnitName(), info, properties);

        initPlugin(original);

        LOGGER.debug("Returning container EntityManager proxy {} instead of EntityManager {}", proxy.getClass(),
                original);
        return proxy;
    }

    /**
     * Creates the entity manager factory proxy.
     *
     * @param persistenceUnitName            persistent unit name
     * @param properties            properties to create entity manager factory
     * @param original            entity manager factory
     * @return proxy of entity manager
     */
    public static EntityManagerFactory createEntityManagerFactoryProxy(String persistenceUnitName, Map<?,?> properties,
            EntityManagerFactory original) {<FILL_FUNCTION_BODY>}

    /**
     * Inits the plugin.
     *
     * @param original the original
     */
    // call initializePlugin and setup version and EJB flag
    private static void initPlugin(EntityManagerFactory original) {
        ClassLoader appClassLoader = original.getClass().getClassLoader();

        String version = Version.getVersionString();

        PluginManagerInvoker.callInitializePlugin(Hibernate3JPAPlugin.class, appClassLoader);
        PluginManagerInvoker.callPluginMethod(Hibernate3JPAPlugin.class, appClassLoader, "init", new Class[] { String.class, Boolean.class }, new Object[] { version, true });

    }
}

        // ensure only once
        if (wrappedPersistenceUnitNames.contains(persistenceUnitName)){
            return original;
        }
        wrappedPersistenceUnitNames.add(persistenceUnitName);

        EntityManagerFactoryProxy wrapper = EntityManagerFactoryProxy.getWrapper(persistenceUnitName);
        EntityManagerFactory proxy = wrapper.proxy(original, persistenceUnitName, null, properties);

        initPlugin(original);

        LOGGER.debug("Returning EntityManager proxy {} instead of EntityManager {}", proxy.getClass(), original);
        return proxy;
    
<no_super_class>